examples/errors/test.js
safarishi c5300652f0 fix mocha test error
1) should emit the error on app

1) Errors should emit the error on app:
     Error: timeout of 2000ms exceeded. Ensure the done() callback is
being called in this test.
2016-07-29 12:11:07 +08:00

23 lines
500 B
JavaScript

var app = require('./app');
var request = require('supertest').agent(app.listen());
describe('Errors', function () {
it('should catch the error', function(done){
request
.get('/')
.expect(500)
.expect('Content-Type', /text\/html/, done);
})
it('should emit the error on app', function(done){
app.once('error', function (err, ctx) {
err.message.should.equal('boom boom');
ctx.should.be.ok;
done();
})
request
.get('/')
.end(done);
})
})