/** @overview nodeunit test case. */

var testResource = require('../../../test_resource'),
    path = require('path'),
    fs = require('fs'),
    generateIndexLessFile = require('../../../../task/worker/generate_index_less_file.js');

exports.setUp = function (done) {
    done();
};

exports.tearDown = function (done) {
    done();
};


exports['Generate index less file.'] = function (test) {
    var workDir = testResource.resolveWorkFile('work_generate_index_less_files');
    testResource.prepareCleanWorkDir(workDir, function () {
        var workFile = path.resolve(workDir, 'work_less.less');
        fs.writeFile(workFile, 'foo', function () {
            generateIndexLessFile({
                dir: workDir
            }, function (err) {
                test.ifError(err);
                fs.exists(workDir + '/_index.less', function (exists) {
                    test.ok(exists);
                    test.done();
                });
            });
        });
    });
};