Open
Description
https://codecov.io/gh/filerjs/filer/src/master/src/filesystem/implementation.js#L568 is a branch we don't test. To hit it, I think we need:
- add at test to
fs.open.spec.js
- open a path
/
(the root directory) and pass the theO_WRITE
flag'w'
- expect an
EISDIR
error to be returned.
Very similar to this test, but with /
instead of /tmp
:
it('should return an error when flagged for write and the path is a directory', function(done) {
var fs = util.fs();
fs.mkdir('/tmp', function(error) {
if(error) throw error;
fs.open('/tmp', 'w', function(error, result) {
expect(error).to.exist;
expect(error.code).to.equal('EISDIR');
expect(result).not.to.exist;
done();
});
});
});