Skip to content

Commit bea6327

Browse files
chore(deps): update dependency fetch-mock to v12 (#640)
* chore(deps): update dependency fetch-mock to v12 * updates tests to use the new v12 fetch-mock apis --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Nick Floyd <[email protected]>
1 parent 7262749 commit bea6327

File tree

5 files changed

+108
-90
lines changed

5 files changed

+108
-90
lines changed

package-lock.json

+39-23
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
@@ -40,7 +40,7 @@
4040
"@types/node": "^22.0.0",
4141
"@vitest/coverage-v8": "^2.0.2",
4242
"esbuild": "^0.24.0",
43-
"fetch-mock": "^11.0.0",
43+
"fetch-mock": "^12.0.0",
4444
"github-openapi-graphql-query": "^4.0.0",
4545
"glob": "^11.0.0",
4646
"npm-run-all2": "^7.0.0",

test/compose-paginate.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ORG2 = { id: 2 };
99

1010
test("composePaginateRest(octokit, route)", async () => {
1111
const mock = fetchMock
12-
.sandbox()
12+
.createInstance()
1313
.get("https://api.github.com/orgs/octokit/repos?per_page=1", {
1414
body: [ORG1],
1515
headers: {
@@ -24,7 +24,7 @@ test("composePaginateRest(octokit, route)", async () => {
2424

2525
const octokit = new Octokit({
2626
request: {
27-
fetch: mock,
27+
fetch: mock.fetchHandler,
2828
},
2929
});
3030

@@ -41,7 +41,7 @@ test("composePaginateRest(octokit, route)", async () => {
4141

4242
test("composePaginateRest.iterator(octokit, route)", () => {
4343
const mock = fetchMock
44-
.sandbox()
44+
.createInstance()
4545
.getOnce("https://api.github.com/organizations", {
4646
body: [ORG1],
4747
headers: {
@@ -56,7 +56,7 @@ test("composePaginateRest.iterator(octokit, route)", () => {
5656

5757
const octokit = new Octokit({
5858
request: {
59-
fetch: mock,
59+
fetch: mock.fetchHandler,
6060
},
6161
});
6262

test/issues.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import { paginateRest } from "../src/index.ts";
88
describe("https://github.com/octokit/plugin-paginate-rest.js/issues/46", () => {
99
it("octokit.paginate('GET /projects/columns/{column}/cards', { column })", async () => {
1010
const mock = fetchMock
11-
.sandbox()
11+
.createInstance()
1212
.get("https://api.github.com/projects/columns/123/cards", {
1313
body: [{ id: 123 }],
1414
});
1515

1616
const TestOctokit = Octokit.plugin(paginateRest);
1717
const octokit = new TestOctokit({
1818
request: {
19-
fetch: mock,
19+
fetch: mock.fetchHandler,
2020
},
2121
});
2222

@@ -32,15 +32,15 @@ describe("https://github.com/octokit/plugin-paginate-rest.js/issues/46", () => {
3232

3333
it("octokit.paginate(octokit.projects.listCards, { column })", async () => {
3434
const mock = fetchMock
35-
.sandbox()
35+
.createInstance()
3636
.get("https://api.github.com/projects/columns/123/cards", {
3737
body: [{ id: 123 }],
3838
});
3939

4040
const TestOctokit = Octokit.plugin(paginateRest, restEndpointMethods);
4141
const octokit = new TestOctokit({
4242
request: {
43-
fetch: mock,
43+
fetch: mock.fetchHandler,
4444
},
4545
});
4646

@@ -55,15 +55,15 @@ describe("https://github.com/octokit/plugin-paginate-rest.js/issues/46", () => {
5555
describe("https://github.com/octokit/plugin-paginate-rest.js/issues/158", () => {
5656
test("handle 204 response for `GET /repos/{owner}/{repo}/contributors` if repository is empty", async () => {
5757
const mock = fetchMock
58-
.sandbox()
58+
.createInstance()
5959
.get("https://api.github.com/repos/owner/empty-repo/contributors", {
6060
status: 204,
6161
});
6262

6363
const TestOctokit = Octokit.plugin(paginateRest);
6464
const octokit = new TestOctokit({
6565
request: {
66-
fetch: mock,
66+
fetch: mock.fetchHandler,
6767
},
6868
});
6969

@@ -80,7 +80,7 @@ describe("https://github.com/octokit/plugin-paginate-rest.js/issues/158", () =>
8080

8181
test("handle 409 response for `GET /repos/{owner}/{repo}/commits` if repository is empty", async () => {
8282
const mock = fetchMock
83-
.sandbox()
83+
.createInstance()
8484
.get("https://api.github.com/repos/owner/empty-repo/commits", {
8585
status: 409,
8686
body: {
@@ -93,7 +93,7 @@ describe("https://github.com/octokit/plugin-paginate-rest.js/issues/158", () =>
9393
const TestOctokit = Octokit.plugin(paginateRest);
9494
const octokit = new TestOctokit({
9595
request: {
96-
fetch: mock,
96+
fetch: mock.fetchHandler,
9797
},
9898
});
9999

0 commit comments

Comments
 (0)