cleaned up code. replaced all callbacks with promises in new test.

This commit is contained in:
Thomas Nolte 2018-10-09 21:57:31 -04:00
parent 871c0fe88c
commit 71a6f514fc
7 changed files with 1882 additions and 2333 deletions

View File

@ -18,7 +18,7 @@
], ],
"linebreak-style": [ "linebreak-style": [
"error", "error",
"unix" "windows"
], ],
"quotes": [ "quotes": [
"error", "error",

589
dist/filer.js vendored

File diff suppressed because it is too large Load Diff

2
dist/filer.map vendored

File diff suppressed because one or more lines are too long

97
dist/filer.min.js vendored

File diff suppressed because one or more lines are too long

0
npm-debug.log.2344590772 Normal file
View File

3476
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -69,44 +69,21 @@ describe('fs.promises.chown', function(){
afterEach(util.setup); afterEach(util.setup);
it('should be a function', function(){ it('should be a function', function(){
var fs= util.fs(); var fsPromises = util.fs().promises;
expect(fs.promises.chown).to.be.a('function'); expect(fsPromises.chown).to.be.a('function');
}); });
it('should allow updating uid and gid for a file', function(done) { it('should allow updating uid and gid for a file', function() {
var fs = util.fs(); var fsPromises = util.fs().promises;
fs.open('/file', 'w', function(err, fd) { return fsPromises.writeFile('/file', 'data')
if(err) throw err; .then(() =>
fsPromises.chown('/file', 500, 500))
fs.fchown(fd, 1001, 1001, function(err) { .then(() =>
if(err) throw err; fsPromises.stat('/file'))
.then((stats) =>{
fs.fstat(fd, function(err, stats){ expect(stats.uid).to.equal(500);
if(err) throw err; expect(stats.gid).to.equal(500);
});
expect(stats.uid).to.equal(1001);
fs.close(fd, function(){
if(err) throw err;
return fs.promises.chown('/file', 500, 500)
.then(()=>{
fs.stat('/file', function(err, stats){
if(err) throw err;
expect(stats.uid).to.equal(500);
expect(stats.gid).to.equal(500);
done();
});
})
.catch((err)=>{
throw(err)
});
});
});
})
});
}); });
}); });