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:
parent
d1afe9719d
commit
a25d71b524
|
@ -105,7 +105,6 @@ describe('fs.unlink', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('fs.promises.unlink', function () {
|
describe('fs.promises.unlink', function () {
|
||||||
beforeEach(util.setup);
|
beforeEach(util.setup);
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
@ -114,4 +113,14 @@ describe('fs.promises.unlink', function () {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
expect(fs.promises.unlink).to.be.a('function');
|
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue