nyc-bookstores/node_modules/router/tests/get-to-all.js
2013-05-27 13:45:59 -07:00

27 lines
550 B
JavaScript

var assert = require('assert');
var route = require('../index')();
var res = {end:function() {}};
var count = 0;
route.get('/', function(req, res, callback) {
assert.equal(req.method, 'GET');
assert.equal(req.url, '/');
assert.equal(count, 0);
count++;
callback();
});
route.all('/', function(req, res, callback) {
assert.equal(req.method, 'GET');
assert.equal(req.url, '/');
assert.equal(count, 1);
count++;
callback();
});
route({method:'GET', url:'/'}, res, function() {
assert.equal(count, 2);
count++;
});
assert.equal(count, 3);