added tests for fs.promises.chown() closes #465 (#471)

* added tests for fs.promises.chown() for check if function exists and updating gid/uid for a file

* update to pass lint tests

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

* Revert "lint tests fix"

This reverts commit 3c256124cf, reversing
changes made to 71a6f514fc.

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

This reverts commit 71a6f514fc.

* Made requested changes.
This commit is contained in:
ThomasNolte 2018-10-16 11:43:59 -04:00 committed by David Humphrey
parent 1eab5f0ffd
commit 3bbabfcb4a
1 changed files with 24 additions and 0 deletions

View File

@ -62,3 +62,27 @@ describe('fs.chown, fs.fchown', function() {
});
});
});
describe('fs.promises.chown', function(){
beforeEach(util.setup);
afterEach(util.setup);
it('should be a function', function(){
var fsPromises = util.fs().promises;
expect(fsPromises.chown).to.be.a('function');
});
it('should allow updating uid and gid for a file', function() {
var fsPromises = util.fs().promises;
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);
});
});
});