nyc-bookstores/node_modules/router/tests/decode.js

16 lines
377 B
JavaScript
Raw Normal View History

2013-05-27 20:45:59 +00:00
var assert = require('assert');
var route = require('../index')();
var res = {end:function() {}};
var count = 0;
route.get('/{a}/*', function(req, res) {
assert.equal(req.params.a, 'a c');
assert.equal(req.params.wildcard, 'b c/c d');
assert.equal(req.url, '/a%20c/b%20c/c%20d');
count++;
});
route({method:'GET', url:'/a%20c/b%20c/c%20d'},res);
assert.equal(count, 1);