Skip to content

Add test for fs.link() with newpath pointing to an existing file #624

@humphd

Description

@humphd

https://codecov.io/gh/filerjs/filer/src/master/src/filesystem/implementation.js#L954 is a branch we don't test. To hit it, I think we need:

  • add a test to fs.link.spec.js
  • create two files
  • try to fs.link() one to the other (i.e., newpath exists)
  • expect an EEXISTS error to be returned

Somewhat similar to this test, but first create a file and use that instead of /mydirlink

  it('should not allow links to a directory', function(done) {
    var fs = util.fs();

    fs.mkdir('/mydir', function(error) {
      if(error) throw error;

      fs.link('/mydir', '/mydirlink', function(error) {
        expect(error).to.exist;
        expect(error.code).to.equal('EPERM');
        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