/** @overview nodeunit test case. */
var fs = require('fs'),
    path = require('path'),
    testResource = require('../../../test_resource'),
    generateStyleguideLess = require('../../../../task/worker/generate_styleguide_less.js');

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

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


exports['Load the templates.'] = function (test) {
    generateStyleguideLess._loadDocLessTmpl(function (err, tmpl) {
        test.ifError(err);
        test.ok(tmpl);
        test.done();
    });
};

exports['Get imports data.'] = function (test) {
    var mockDir = testResource.resolveMockFile('mock_modules');

    fs.readdir(mockDir, function (err, filenames) {
        generateStyleguideLess._importsData(
            filenames.map(function (filename) {
                return path.resolve(mockDir, filename);
            }),
            testResource.resolveWorkFile('.'),
            function (err) {
                test.ifError(err);
                generateStyleguideLess._importsData(null, null, function (err) {
                    test.ok(err);
                    test.done();
                });
            }
        )
    });
};

exports['Get color data.'] = function (test) {
    var data = generateStyleguideLess._colorData();
    test.ok(data);
    test.done();
};