fetch-mock-jest
Advanced tools
Comparing version 0.0.1 to 0.1.2
{ | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
18003
12
469
28
7
73
+ Addedcore-js@3.37.1(transitive)
+ Addedfetch-mock@8.3.2(transitive)
+ Addedquerystring@0.2.1(transitive)
- Removedbabel-polyfill@6.26.0(transitive)
- Removedfetch-mock@7.7.3(transitive)
- Removedregenerator-runtime@0.10.5(transitive)
Updatedfetch-mock@^8.0.0