add app "error" test

This commit is contained in:
TJ Holowaychuk 2013-09-08 09:37:19 -07:00
parent 6a51f73524
commit 42f5aa1e61

View file

@ -205,6 +205,25 @@ describe('app.respond', function(){
}) })
describe('when an error occurs', 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(){ describe('with a .status property', function(){
it('should respond with .status', function(done){ it('should respond with .status', function(done){
var app = koa(); var app = koa();