Skip to content

Commit 6622d99

Browse files
committed
chore: upgrading fetch-mock
1 parent 3e3339c commit 6622d99

File tree

3 files changed

+38
-27
lines changed

3 files changed

+38
-27
lines changed

package-lock.json

+30-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"datauri": "^4.1.0",
5959
"eslint": "^8.57.0",
6060
"express": "^4.18.1",
61-
"fetch-mock": "^11.1.3",
61+
"fetch-mock": "^12.2.1",
6262
"har-examples": "^3.1.1",
6363
"msw": "^2.0.2",
6464
"multer": "^1.4.5-lts.1",

test/mocking/fetch-mock.test.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ import fetchHAR from '../../src/index.js';
66

77
describe('#fetchHAR mocking (fetch-mock)', () => {
88
it('should support mocking a request with `fetch-mock`', async () => {
9-
fetchMock.mock(
10-
{
11-
url: 'https://httpbin.org/get',
12-
method: 'get',
13-
},
14-
new Response(null, { status: 429 }),
15-
);
9+
fetchMock.mockGlobal().route({
10+
url: 'https://httpbin.org/get',
11+
method: 'get',
12+
response: new Response(null, { status: 429 }),
13+
});
1614

1715
const res = await fetchHAR(harExamples.short);
1816
expect(res.status).toBe(429);
1917

20-
fetchMock.restore();
18+
fetchMock.clearHistory();
19+
fetchMock.unmockGlobal();
2120
});
2221
});

0 commit comments

Comments
 (0)