/** @overview nodeunit test case. */

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

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

exports.tearDown = function (done) {
    mockInjector.restoreAll();
    done();
};
exports['Get render data.'] = function (test) {
    var data = generateScaffoldFiles._renderData('fooBar');
    test.equal(data.name, 'fooBar');
    test.equal(data.snake_name, 'foo_bar');
    test.equal(data.SNAKE_NAME, 'FOO_BAR');
    test.equal(data.hyphenName, 'foo-bar');
    test.equal(data.camelName, 'fooBar');
    test.equal(data.CamelName, 'FooBar');
    test.done();
};

exports['Generate scaffold files.'] = function (test) {
    testResource.prepareCleanWorkDirForTestFile(__filename, function (err, workDir) {
        generateScaffoldFiles({
            tmplFile: testResource.resolveMockFile('mock-template.hbs'),
            destFormat: workDir + '/work_%s.js',
            names: ['foo', 'bar']
        }, function (err) {
            test.ifError(err);
            test.done();
        });
    });
};