Skip to content
Myr

Added route regexp tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 77c9d92 · Browse files · 1 file+28 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+28 added−0 removed

  • tests:+28 added−0 removed

1 file+28 added−0 removed

modified:test/app.router.js+28 added
59 unmodified lines
60 done();61 })62 })6364 describe('when given a regexp', function(){65 it('should match the pathname only', function(done){66 var app = express();6768 app.get(/^\/user\/[0-9]+$/, function(req, res){69 res.end('user');70 });7172 request(app)73 .get('/user/12?foo=bar')74 .expect('user', done);75 })76 77 it('should populate req.params with the captures', function(done){78 var app = express();7980 app.get(/^\/user\/([0-9]+)\/(view|edit)?$/, function(req, res){81 var id = req.params.shift()82 , op = req.params.shift();83 res.end(op + 'ing user ' + id);84 });8586 request(app)87 .get('/user/10/edit')88 .expect('editing user 10', done);89 })90 })9192 describe('case sensitivity', function(){93 it('should be disabled by default', function(done){94 var app = express();95
166 unmodified lines