Skip to content
Myr

tests: add mounting to strict routing test

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

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent bcdeee2 · Browse files · 1 file+82 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+82 added−0 removed

  • tests:+82 added−0 removed

1 file+82 added−0 removed

modified:test/app.router.js+82 added
366 unmodified lines
367 .get('/user/')368 .expect('tj', done);369 })370371 it('should pass-though middleware', function(done){372 var app = express();373374 app.enable('strict routing');375376 app.use(function (req, res, next) {377 res.setHeader('x-middleware', 'true');378 next();379 });380381 app.get('/user/', function(req, res){382 res.end('tj');383 });384385 request(app)386 .get('/user/')387 .expect('x-middleware', 'true')388 .expect(200, 'tj', done);389 })390391 it('should pass-though mounted middleware', function(done){392 var app = express();393394 app.enable('strict routing');395396 app.use('/user/', function (req, res, next) {397 res.setHeader('x-middleware', 'true');398 next();399 });400401 app.get('/user/test/', function(req, res){402 res.end('tj');403 });404405 request(app)406 .get('/user/test/')407 .expect('x-middleware', 'true')408 .expect(200, 'tj', done);409 })410411 it('should match no slashes', function(done){412 var app = express();413414 app.enable('strict routing');
6 unmodified lines
421 .get('/user')422 .expect('tj', done);423 })424425 it('should match middleware when omitting the trailing slash', function(done){426 var app = express();427428 app.enable('strict routing');429430 app.use('/user/', function(req, res){431 res.end('tj');432 });433434 request(app)435 .get('/user')436 .expect(200, 'tj', done);437 })438439 it('should match middleware', function(done){440 var app = express();441442 app.enable('strict routing');443444 app.use('/user', function(req, res){445 res.end('tj');446 });447448 request(app)449 .get('/user')450 .expect(200, 'tj', done);451 })452453 it('should match middleware when adding the trailing slash', function(done){454 var app = express();455456 app.enable('strict routing');457458 app.use('/user', function(req, res){459 res.end('tj');460 });461462 request(app)463 .get('/user/')464 .expect(200, 'tj', done);465 })466467 it('should fail when omitting the trailing slash', function(done){468 var app = express();469470 app.enable('strict routing');
432 unmodified lines