Skip to content

Commit de7ffca

Browse files
committed
tests: add test for matching route after error
1 parent 2ac2509 commit de7ffca

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/app.routes.error.js

+16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ var express = require('../')
33

44
describe('app', function(){
55
describe('.VERB()', function(){
6+
it('should not get invoked without error handler on error', function(done) {
7+
var app = express();
8+
9+
app.use(function(req, res, next){
10+
next(new Error('boom!'))
11+
});
12+
13+
app.get('/bar', function(req, res){
14+
res.send('hello, world!');
15+
});
16+
17+
request(app)
18+
.post('/bar')
19+
.expect(500, /Error: boom!/, done);
20+
});
21+
622
it('should only call an error handling routing callback when an error is propagated', function(done){
723
var app = express();
824

0 commit comments

Comments
 (0)