resin-fetch-mock
v1.0.3
Published
Common util to mock fetch requests in resin tests
Downloads
11
Readme
resin-fetch-mock
Common util to mock fetch requests in resin tests
Installation
Install resin-fetch-mock
by running:
$ npm install --save resin-fetch-mock
Documentation
The module exposes two methods:
const { fetchMock, mockedFetch } = require("resin-fetch-mock")
The fetchMock
is a sandboxed
instance of fetch-mock
preconfigured with the Bluebird
Promise implementation.
Use it according to the fetch-mock documentation.
The mockedFetch
function can be injected into your code as a drop-in replacement
of the original fetch
.
Note: in the browser environment requiring this module will set the
Headers
, Request
, and Response
constructors globally.
These constructors are taken from the fetch-ponyfill
module.
Support
If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.
Contribute
- Issue Tracker: github.com/resin-io-modules/resin-fetch-mock/issues
- Source Code: github.com/resin-io-modules/resin-fetch-mock
License
The project is licensed under the Apache 2.0 license.