diff --git a/tests/spec/fs.copyFile.spec.js b/tests/spec/fs.copyFile.spec.js index 940f2fb..a61a762 100644 --- a/tests/spec/fs.copyFile.spec.js +++ b/tests/spec/fs.copyFile.spec.js @@ -1,5 +1,6 @@ var util = require('../lib/test-utils.js'); var expect = require('chai').expect; +const { COPYFILE_EXCL } = require('../../src/constants').fsConstants; // Waiting on implementation to land https://github.com/filerjs/filer/issues/436 describe.skip('fs.copyFile', function() { @@ -45,4 +46,19 @@ describe.skip('fs.copyFile', function() { }); }); }); + + it('should return an error if flag=COPYFILE_EXCL and the destination file exists', function (done) { + var fs = util.fs(); + const destPath = '/destfile'; + + fs.writeFile(destPath, 'data', function(error) { + if(error) throw error; + + fs.copyFile(file.path, destPath, COPYFILE_EXCL, function(error) { + expect(error).to.exist; + expect(error.code).to.equal('ENOENT'); + done(); + }); + }); + }); });