Fixed issue#480 using promises to test fs.truncate when path does not exist (#516)

* added a test for issue#480 using promises to test fs.truncate

* Fixed issue#480 tesing fs.truncate using promises when path does not exist
This commit is contained in:
Huda Al Dallal 2018-10-09 12:56:20 -04:00 committed by David Humphrey
parent 0354c7e13e
commit 2e2e2f9d64
1 changed files with 15 additions and 0 deletions

View File

@ -223,3 +223,18 @@ describe('fs.truncate', function() {
});
});
});
describe('fsPromises.truncate', function () {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should error when path does not exist (with promises)', () => {
var fsPromises = util.fs().promises;
return fsPromises.truncate('/NonExistingPath', 0)
.catch(error => {
expect(error).to.exist;
expect(error.code).to.equal('ENOENT');
});
});
});