it('Should return a bad basepath error', function(done) {
            dependency.file(null, 'fixtures/badpath/sample.schema.json', function(err) {
                assert.notEqual(err, null);
                done();
            });

        });
        it('Should return an error for bad json', function(done) {
            dependency.file(__dirname, 'fixtures/bad.json', function(err) {
                assert.notEqual(err, null);
                done();
            });

        });
        it('Should return a string with json schema file', function(done) {
            dependency.file(__dirname, 'fixtures/sample.schema.json', function(err) {
                assert.equal(err, null);
                done();
            });

        });
        it('Should return a file not found error', function(done) {
            dependency.file(__dirname, 'fixtures/badpath/sample.schema.json', function(err) {
                assert.notEqual(err, null);
                done();
            });

        });
Esempio n. 5
0
 fs.stat(filepath, function (err, stats) {
   if (err) {
     return callback(err);
   } else {
     var parts = {};
     var byte_offset = 0;
     var size = stats.size;
     var num_parts = Math.ceil(size / part_size);
     var progressCount = 0;
     for (var i = 0; i < num_parts; i++) {
       byte_offset = (part_size * i);
       md5sum(filepath, {
         start: byte_offset,
         end: ( byte_offset + part_size )
       }, function(hash, offset) {
         progressCount ++;
         if (progress) {
           var percent = Math.ceil((progressCount/num_parts)*100);
           progress(percent);
         }
         parts[String(offset)] = hash;
         if (Object.keys(parts).length === num_parts) {
           return callback(null, parts, size);
         }
       });
     }
   }
 });
Esempio n. 6
0
		it(imp, function(done){
			var file = copy + '/config.yml'
			assert(fs.existsSync(file))
			when(rmdir.file(file), function(){
				assert(!fs.existsSync(file))
				done()
			})
		})
Esempio n. 7
0
 it('should the preferences directory depending on the platform', () => {
   let pref_file;
   if (process.platform === 'darwin') {
     pref_file = path.join(process.env.HOME, 'Library/Application Support/Championify/prefs.json');
   } else {
     pref_file = path.join(process.env.APPDATA, 'Championify/prefs.json');
   }
   preferences.file().should.equal(pref_file);
 });
Esempio n. 8
0
        function installComponentAndLog(file) {
            var source = installComponents+file, destination= installDirectory+file

            var f = install.file(source, destination)
            f.resolve(f, function(result) {
                if(!result) {
                    utils.log('Skipping installing '+destination+' since it already exists.')
                }
            })
            return f
        }
Esempio n. 9
0
 it('handles sc', function () {
   expect(namer.file('my_foo')).to.equal('myFoo');
 });
Esempio n. 10
0
 it('handles lc', function () {
   expect(namer.file('foo')).to.equal('foo');
 });
Esempio n. 11
0
 it('should null when no preferences exist', () => {
   fs.removeSync(preferences.file());
   should.not.exist(preferences.load());
 });
Esempio n. 12
0
 .then(() => {
   fs.existsSync(preferences.file()).should.equal(true);
 });