Skip to content

Commit

Permalink
Review fixes, skip copyFile test for now
Browse files Browse the repository at this point in the history
  • Loading branch information
humphd committed Dec 17, 2018
1 parent 62cbe11 commit ba18816
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions tests/spec/fs.copyFile.spec.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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();
});
});
});

});
});

0 comments on commit ba18816

Please sign in to comment.