Nock
Replace Node.js HTTP requests with predictable local responses during tests.
nock · Code and testing
GitHub projectOpen source Open on GitHubHow to try it
In a Node.js project, install [email protected]. Mock a fictional inventory endpoint and read the response from a local request.
What we tested
15.0.6. Mock a fictional inventory endpoint and read the response from a local request. Matched exactly the fake stock request and returned its configured value seven.