Review fixes, skip copyFile test for now
This commit is contained in:
parent
62cbe11a93
commit
ba188169d6
|
@ -1,17 +1,17 @@
|
|||
var util = require('../lib/test-utils.js');
|
||||
var expect = require('chai').expect;
|
||||
|
||||
describe('fs.copyFile', function(){
|
||||
// Waiting on implementation to land https://github.com/filerjs/filer/issues/436
|
||||
describe.skip('fs.copyFile', function() {
|
||||
const file = {
|
||||
path: '/srcfile',
|
||||
contents: 'This is a src file.'
|
||||
};
|
||||
|
||||
beforeEach(function(done){
|
||||
util.setup(function() {
|
||||
var fs = util.fs();
|
||||
fs.writeFile('/srcfile', 'This is a src file.', function(error){
|
||||
if(error) throw error;
|
||||
fs.writeFile('/destfile', 'This is a dest file.', function(error){
|
||||
if(error) throw error;
|
||||
done();
|
||||
});
|
||||
});
|
||||
fs.writeFile(file.path, file.contents, done);
|
||||
});
|
||||
});
|
||||
afterEach(util.cleanup);
|
||||
|
@ -23,30 +23,26 @@ describe('fs.copyFile', function(){
|
|||
|
||||
it('should return an error if the src path does not exist', function(done){
|
||||
var fs = util.fs();
|
||||
var src = null;
|
||||
var dest = 'dest.txt';
|
||||
|
||||
fs.copyFile(src, dest, function(error){
|
||||
fs.copyFile(null, '/dest.txt', function(error) {
|
||||
expect(error).to.exist;
|
||||
expect(error.code).to.equal('ENOENT');
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('should copy file successfully', function(done) {
|
||||
var fs = util.fs();
|
||||
var src = 'This is a src file.';
|
||||
const destPath = '/destfile';
|
||||
|
||||
fs.copyFile('/srcfile', '/destfile', function(error) {
|
||||
fs.copyFile(file.path, destPath, function(error) {
|
||||
if(error) throw error;
|
||||
|
||||
fs.readFile('/destfile', function(error, data){
|
||||
fs.readFile(destPath, function(error, data) {
|
||||
expect(error).not.to.exist;
|
||||
expect(data).to.equal(src);
|
||||
expect(data).to.equal(file.contents);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue