Skip to content

Add test for fs.open() with O_WRITE and the root directory as path / #622

Open
@humphd

Description

@humphd

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 the O_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();
      });
    });
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions