resin-fetch-mock

1.0.3 • Public • Published

resin-fetch-mock

Common util to mock fetch requests in resin tests

npm version dependencies

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

License

The project is licensed under the Apache 2.0 license.

Readme

Keywords

Package Sidebar

Install

npm i resin-fetch-mock

Weekly Downloads

0

Version

1.0.3

License

Apache-2.0

Last publish

Collaborators

  • guard
  • balena.io