mirror of
https://github.com/koajs/examples.git
synced 2026-01-18 14:38:19 +00:00
25 lines
537 B
JavaScript
25 lines
537 B
JavaScript
require('should');
|
|
const app = require('./app');
|
|
const 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(function() {});
|
|
});
|
|
});
|