Adding more tests for fs.copyFile
Co-authored-by: David Humphrey <david.humphrey@senecacollege.ca>
This commit is contained in:
parent
ba188169d6
commit
848cc7d3de
|
@ -1,5 +1,6 @@
|
||||||
var util = require('../lib/test-utils.js');
|
var util = require('../lib/test-utils.js');
|
||||||
var expect = require('chai').expect;
|
var expect = require('chai').expect;
|
||||||
|
const { COPYFILE_EXCL } = require('../../src/constants').fsConstants;
|
||||||
|
|
||||||
// Waiting on implementation to land https://github.com/filerjs/filer/issues/436
|
// Waiting on implementation to land https://github.com/filerjs/filer/issues/436
|
||||||
describe.skip('fs.copyFile', function() {
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue