/** @overview nodeunit test case. */

var testResource = require('../../../test_resource'),
    mockInjector = require('../../../mock_injector'),
    generateVisualizeJsonFiles = require('../../../../ci/worker/generate_visualize_json_files.js');

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

exports.tearDown = function (done) {
    mockInjector.restoreAll();
    done();
};
exports['Format destination file.'] = function (test) {
    var dest = generateVisualizeJsonFiles._formatDest('foo/bar/%s-visual.json', 'foo/bar/baz.js');
    test.equal(dest, 'foo/bar/baz-visual.json');
    test.done();
};


exports['Generate visualize json files.'] = function (test) {
    testResource.prepareCleanWorkDirForTestFile(__filename, function (err, workDir) {
        generateVisualizeJsonFiles({
            srcPattern: testResource.resolveMockFile('mock_modules2/*_say.js'),
            destFormat: workDir + '/work-%s-visual.json'
        }, function (err) {
            test.ifError(err);
            test.done();
        });
    });
};