sinon-express-mock
Simple request and response mock objects to pass into Express routes when testing using Sinon.
The mock objects attach Sinon spys to request methods. See src/index.js
for a full list of stubbed out methods.
Install
npm install --save-dev sinon-express-mock sinon
Depends on:
- Node v4+ (or
Object.assign
support needed) - Sinon
Usage
Contents of src/foo.js
:
{ res}
Contents of test/foo-test.js
:
chai;
Changelog
v2.0.3
res.write()
is now stubbed.
v2.0.0
- Make sinon a
peerDependency
.
v1.3.1
- Bundle fix from #3
pre v1.3.1
- Changelog didn't exist! 😱
Credits
Dana Woodman and contributors
License
MIT