var testResource = require('../../../test_resource'),
    publishHtmlFiles = require('../../../../task/worker/publish_html_files.js');

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

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

exports['Create link name.'] = function (test) {
    test.equal('foo-bar-baz', publishHtmlFiles._linkName('foo/bar/baz.html', '.html'));
    test.equal('foo-bar-baz', publishHtmlFiles._linkName('foo/bar/baz.min.html', '.min.html'));
    test.equal('index.html', publishHtmlFiles._linkName('index.html'));
    test.equal('index.html', publishHtmlFiles._linkName('index.min.html'));
    test.done();
};

exports['Publish html.'] = function (test) {
    var workDir = testResource.resolveWorkFile('work_publish_html');
    testResource.prepareCleanWorkDir(workDir, function () {
        publishHtmlFiles({
            srcDir: testResource.resolveMockFile('.'),
            destDir: workDir
        }, function (err) {
            test.ifError(err);
            test.done();
        });
    });
};