From de7ffca33ff30932bdaa2dbe51862af32e8a30b1 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Fri, 24 Jul 2015 21:36:56 -0400 Subject: [PATCH] tests: add test for matching route after error --- test/app.routes.error.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/app.routes.error.js b/test/app.routes.error.js index ac517efd..7c49d50f 100644 --- a/test/app.routes.error.js +++ b/test/app.routes.error.js @@ -3,6 +3,22 @@ var express = require('../') describe('app', function(){ describe('.VERB()', function(){ + it('should not get invoked without error handler on error', function(done) { + var app = express(); + + app.use(function(req, res, next){ + next(new Error('boom!')) + }); + + app.get('/bar', function(req, res){ + res.send('hello, world!'); + }); + + request(app) + .post('/bar') + .expect(500, /Error: boom!/, done); + }); + it('should only call an error handling routing callback when an error is propagated', function(done){ var app = express();