/** @overview nodeunit test case. */

var testResource = require('../../../test_resource'),
    fs = require('fs'),
    concatAndCompileCoffeeScriptFiles = require('../../../../task/worker/concat_and_compile_coffee_script_files.js');

exports.setUp = function (done) {
    process.env.TASK_LOG_DISABLED = true;
    done();
};

exports.tearDown = function (done) {
    process.env.TASK_LOG_DISABLED = false;
    done();
};

exports['Concat contents.'] = function (test) {
    concatAndCompileCoffeeScriptFiles._concatContents(['foo', 'bar'], null, function (err, result) {
        test.ifError(err);
        test.equal(result, 'foo\nbar');
        test.done();
    });
};
exports['Concat an d compile coffee script.'] = function (test) {
    var src = testResource.resolveMockFile('*.coffee'),
        dest = testResource.resolveWorkFile('work-concat-and-compiled-coffee.coffee');
    concatAndCompileCoffeeScriptFiles({
        src: src,
        dest: dest,
        ignore: 'foo'
    }, function (err) {
        test.ifError(err);
        fs.exists(dest, function (exists) {
            test.strictEqual(exists, true);
            test.done();
        });
    });
};