Skip to content
Myr

Added router next(err) test

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 772b752 · Browse files · 1 file+36 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+36 added−0 removed

  • tests:+36 added−0 removed

1 file+36 added−0 removed

modified:test/app.router.js+36 added
468 unmodified lines
469 done();470 })471 })472 })473 474 describe('when next(err) is called', function(){475 it('should break out of app.router', function(done){476 var app = express()477 , calls = [];478479 app.get('/foo/:bar?', function(req, res, next){480 calls.push('/foo/:bar?');481 next();482 });483484 app.get('/bar', function(req, res){485 assert(0);486 });487488 app.get('/foo', function(req, res, next){489 calls.push('/foo');490 next(new Error('fail'));491 });492 493 app.get('/foo', function(req, res, next){494 assert(0);495 });496497 app.use(function(err, req, res, next){498 res.end(err.message);499 })500501 request(app)502 .get('/foo')503 .expect('fail', function(){504 calls.should.eql(['/foo/:bar?', '/foo']);505 done();506 })507 })508 })509})