Fix #435: add a test for fsPromise.unlink() to delete a file that does not exist

Make changes to `fsPromises.unlink()` to be more promise-friendly

Added a newline to the end of the file

Made a change to fsPromises.unlink() to be more friendly

Changed the description of the promises test
This commit is contained in:
Susan Truong 2018-09-21 17:17:12 -04:00 committed by David Humphrey
parent d1afe9719d
commit a25d71b524
1 changed files with 10 additions and 1 deletions

View File

@ -105,7 +105,6 @@ describe('fs.unlink', function() {
});
});
describe('fs.promises.unlink', function () {
beforeEach(util.setup);
afterEach(util.cleanup);
@ -114,4 +113,14 @@ describe('fs.promises.unlink', function () {
var fs = util.fs();
expect(fs.promises.unlink).to.be.a('function');
});
it('should return an error if trying to delete a file that does not exist', function() {
var fsPromises = util.fs().promises;
return fsPromises.unlink('/myFile')
.catch(error => {
expect(error).to.exist;
expect(error.code).to.equal('ENOENT');
});
});
});