Adding more tests for fs.copyFile

Co-authored-by: David Humphrey <david.humphrey@senecacollege.ca>
This commit is contained in:
Yuecheng Wu 2018-09-24 14:35:41 -04:00 committed by David Humphrey
parent ba188169d6
commit 848cc7d3de
1 changed files with 16 additions and 0 deletions

View File

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