Fix #419: Add test for fsPromises.open() when the path does not exist (#455)

* Fix #419: Add test for fsPromises.open() when the path does not exist

* Update package.json

* Fix #419: Add test for fsPromises.open() when the path does not exist

Removed some unnecessary code based on reviews

* Update fs.open.spec.js
This commit is contained in:
Stephen Truong 2018-10-09 16:00:56 -04:00 committed by David Humphrey
parent c7ea45a18b
commit 934ef8bfa7
1 changed files with 19 additions and 0 deletions

View File

@ -137,3 +137,22 @@ describe('fs.open', function() {
}); });
}); });
}); });
/**
* fsPromise.open() Tests
**/
describe('fsPromises.open', function() {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should return an error if the parent path does not exist', function() {
var fsPromises = util.fs().promises;
return fsPromises.open('/tmp/myfile', 'w+')
.then(result => expect(result).not.to.exist)
.catch(error => {
expect(error).to.exist;
expect(error.code).to.equal('ENOENT');
});
});
});