filer
filer copied to clipboard
Add test for fs.link() with newpath pointing to an existing file
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.,newpathexists) - expect an
EEXISTSerror 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();
});
});
});
Also, add another test for the same case using symlink instead of link, and try to hit https://codecov.io/gh/filerjs/filer/src/master/src/filesystem/implementation.js#L1147.