From 42f5aa1e619e0c830f3cbae171b8f8a468233cdc Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sun, 8 Sep 2013 09:37:19 -0700 Subject: [PATCH] add app "error" test --- test/application.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/application.js b/test/application.js index 364fe46..be5ebba 100644 --- a/test/application.js +++ b/test/application.js @@ -205,6 +205,25 @@ describe('app.respond', function(){ }) describe('when an error occurs', function(){ + it('should emit "error" on the app', function(done){ + var app = koa(); + + app.use(function(next){ + return function *(){ + throw new Error('boom'); + } + }); + + app.on('error', function(err){ + err.message.should.equal('boom'); + done(); + }); + + request(app.listen()) + .get('/') + .end(function(){}); + }) + describe('with a .status property', function(){ it('should respond with .status', function(done){ var app = koa();