var fs = require('fs'),
    testResource = require('../../../test_resource'),
    copyFile = require('../../../../lib/file/copy_file');

exports['Copy a file'] = function (test) {
    var dest = testResource.resolveWorkFile('work_file_copy.txt');
    copyFile(
        testResource.resolveMockFile('mock_files/mock_txt.txt'),
        dest,
        function (err) {
            test.ifError(err);
            fs.exists(dest, function (exists) {
                test.ifError(err);
                test.done();
            });
        }
    );
};
exports['Handle error.'] = function (test) {
    var errorHandler = copyFile._errorHandler(function (err) {
        test.ok(err);
        test.done();
    });
    errorHandler(new Error('Foo'));
    errorHandler(new Error('bar'));
};