Socket
Socket
Sign inDemoInstall

fetch-mock-jest

Package Overview
Dependencies
19
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.1.2

__tests__/jest-built-ins.spec.js

7

package.json
{
"name": "fetch-mock-jest",
"version": "0.0.1",
"version": "0.1.2",
"description": "",
"main": "index.js",
"main": "fetch-mock-jest.js",
"scripts": {

@@ -21,3 +21,3 @@ "test": "echo \"Error: no test specified\" && exit 1"

"dependencies": {
"fetch-mock": "^7.7.3"
"fetch-mock": "^8.0.0"
},

@@ -29,2 +29,3 @@ "devDependencies": {

"eslint-plugin-prettier": "^3.1.1",
"jest": "^24.9.0",
"node-fetch": "^2.6.0",

@@ -31,0 +32,0 @@ "prettier": "^1.18.2"

@@ -5,2 +5,24 @@ # fetch-mock-jest

Will be implemented soon. I promise :-)
# Installation
## global fetch
`const fetchMock = require('fetch-mock-jest')`
## node-fetch
```
jest.mock('node-fetch', () => require('fetch-mock-jest'))
const fetchMock = require('node-fetch')
```
# API
`expect(fetchMock)` can be inspected using all the built in jest function inspection assertions. `fetch.mockClear()` and `fetch.mockReset()` shodul aslo work (however all other jest mock setup methods are disabled as fetch-mock's own methdos should always be used)
In addition, the following work:
`expect(fetchMock).toHaveLastFetched(url, options)`
`expect(fetchMock).toHaveNthFetched(n, url, options)`
`expect(fetchMock).toHaveFetchedTimes(times, url, options)`
`expect(fetchMock).toBeDone(matcher)`
, proxying through to the similar fetchMock methods.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc