superagent-nock
Very simple mock of superagent http requests for testing purpose (from Node.js or the browser). Inspired by superagent-mocker, superagent-mock and nock.
Used for testing React components with Redux and Observable.
Usage
Setup
;;const nock = ;
Use
Define the base url
The url to mock
nock
The result to return
nock
or specify a function
nock
Then, when you do a get request on the url, the callback return the specified result
; request
Chaining
You can chain your urls to mock:
;
Install
You should probably install it in devDependencies (-D)
$ npm i -D superagent-nock
Next TODO
nock.delay nock.query