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": [
"error",
"unix"
"windows"
],
"quotes": [
"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);
it('should be a function', function(){
var fs= util.fs();
expect(fs.promises.chown).to.be.a('function');
var fsPromises = util.fs().promises;
expect(fsPromises.chown).to.be.a('function');
});
it('should allow updating uid and gid for a file', function(done) {
var fs = util.fs();
it('should allow updating uid and gid for a file', function() {
var fsPromises = util.fs().promises;
fs.open('/file', 'w', function(err, fd) {
if(err) throw err;
fs.fchown(fd, 1001, 1001, function(err) {
if(err) throw err;
fs.fstat(fd, function(err, stats){
if(err) throw err;
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)
});
});
});
})
});
return fsPromises.writeFile('/file', 'data')
.then(() =>
fsPromises.chown('/file', 500, 500))
.then(() =>
fsPromises.stat('/file'))
.then((stats) =>{
expect(stats.uid).to.equal(500);
expect(stats.gid).to.equal(500);
});
});
});