/** @overview nodeunit test case. */

var testResource = require('../../../test_resource'),
    _expandGlobUnlessIgnored = require('../../../../ci/worker/_expand_glob_unless_ignored.js');

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

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


exports['Expand glob unless ignored.'] = function (test) {
    _expandGlobUnlessIgnored(__dirname + '/*', __filename, function (err, filenames) {
        test.ifError(err);
        test.ifError(~filenames.indexOf(__filename));
        test.done();
    });
};
exports['Handle error.'] = function (test) {
    var _expandGlob = _expandGlobUnlessIgnored._expandGlob;
    _expandGlobUnlessIgnored._expandGlob = function (pattern, callback) {
        callback(new Error('mock expand glob error'));
    };
    _expandGlobUnlessIgnored('foo', '*', function (err) {
        test.ok(err);
        _expandGlobUnlessIgnored._expandGlob = _expandGlob;
        test.done();
    });
};