UNPKG

449 BJavaScriptView Raw
1import { expect } from 'chai';
2import sinon from 'sinon';
3
4import empty from '../../../src/middleware/empty';
5
6it('should `404` by default', () => {
7 const spy = sinon.spy();
8 const res = { end: spy };
9 const app = empty();
10 app.request({}, res);
11 expect(res).to.have.property('statusCode', 404);
12});
13
14it('should throw errors it encounters', () => {
15 const app = empty();
16 expect(() => {
17 app.error(new Error());
18 }).to.throw(Error);
19});