chai-api
Assertion helper for api testing.
Features
- Use chai and request-promise.
- Require mocha-generators
- ES6 generator
Pre-install
npm install mocha-generators
How to use
; const assert = assert;const api = 'http://some/api/url'; ;
APIs
api(method, path, req)
A generator to do api call.
api.success(method, path, req)
Do api call and assert for result.isSuccess
be true
.
api.notSuccess(method, path, req)
Do api call and assert for result.isSuccess
be false
.
ToDo
- Able to define expected result schema