/** @overview nodeunit test case. */

var testResource = require('../../../test_resource'),
    newUrlResolver = require('../../../../lib/url/new_url_resolver.js');

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

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


exports['Create a new url resolver.'] = function (test) {
    var resolve = newUrlResolver({params: {foo: 'bar'}});

    test.equal(resolve('baz'), '/baz?foo=bar');
    test.equal(resolve.js('quz.js'), '/js/quz.js?foo=bar');
    test.equal(resolve.css('quz.css'), '/css/quz.css?foo=bar');
    test.equal(resolve.img('quz.png'), '/img/quz.png?foo=bar');

    test.done();
};
exports['Create a new url resolver with convert rules.'] = function (test) {

    var resolve = newUrlResolver({
        params: {foo: 'bar'},
        convertRules: [
            [/\.js$/, '.min.js'],
            [/\.css$/, '.min.css']
        ]
    });
    test.equal(resolve('baz'), '/baz?foo=bar');
    test.equal(resolve.js('quz.js'), '/js/quz.min.js?foo=bar');
    test.done();
};