mirror of
https://github.com/koajs/examples.git
synced 2026-01-18 14:38:19 +00:00
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.
23 lines
500 B
JavaScript
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);
|
|
})
|
|
}) |