/** @overview nodeunit test case. */

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

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

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


exports['Create aliases.'] = function (test) {
    var workDir = testResource.resolveWorkFile('work-generate_styleguide_aliases');
    testResource.prepareCleanWorkDir(workDir, function () {
        setTimeout(function () {
            var workFilename = testResource.resolveWorkFile(workDir, 'work_file_to_link.txt');
            fs.writeFile(workFilename, 'foo-bar', function () {
                _createAliases([
                    {
                        from: workFilename,
                        to: testResource.resolveWorkFile(workDir, 'work_link.txt')
                    }
                ],
                    function (err) {
                        test.ifError(err);
                        test.done();
                    });
            });
        }, 30)
    });
};