UNPKG

333 BJavaScriptView Raw
1import { expect } from 'chai';
2import sinon from 'sinon';
3
4import id from '../../../src/middleware/id';
5
6it('should assign an id property to the request', () => {
7 const spy = sinon.spy();
8 const app = id()({ request: spy });
9 app.request({}, { setHeader: sinon.spy() });
10 expect(spy).to.be.calledWithMatch(req => !!req.id);
11});