Skip to content

Commit

Permalink
chore(deps): update dependency fetch-mock to v12 (#640)
Browse files Browse the repository at this point in the history
* 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 <nicholas.floyd.info@gmail.com>
  • Loading branch information
renovate[bot] and nickfloyd authored Dec 26, 2024
1 parent 7262749 commit bea6327
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 90 deletions.
62 changes: 39 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^2.0.2",
"esbuild": "^0.24.0",
"fetch-mock": "^11.0.0",
"fetch-mock": "^12.0.0",
"github-openapi-graphql-query": "^4.0.0",
"glob": "^11.0.0",
"npm-run-all2": "^7.0.0",
Expand Down
8 changes: 4 additions & 4 deletions test/compose-paginate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ORG2 = { id: 2 };

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

const octokit = new Octokit({
request: {
fetch: mock,
fetch: mock.fetchHandler,
},
});

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

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

const octokit = new Octokit({
request: {
fetch: mock,
fetch: mock.fetchHandler,
},
});

Expand Down
16 changes: 8 additions & 8 deletions test/issues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { paginateRest } from "../src/index.ts";
describe("https://github.com/octokit/plugin-paginate-rest.js/issues/46", () => {
it("octokit.paginate('GET /projects/columns/{column}/cards', { column })", async () => {
const mock = fetchMock
.sandbox()
.createInstance()
.get("https://api.github.com/projects/columns/123/cards", {
body: [{ id: 123 }],
});

const TestOctokit = Octokit.plugin(paginateRest);
const octokit = new TestOctokit({
request: {
fetch: mock,
fetch: mock.fetchHandler,
},
});

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

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

const TestOctokit = Octokit.plugin(paginateRest, restEndpointMethods);
const octokit = new TestOctokit({
request: {
fetch: mock,
fetch: mock.fetchHandler,
},
});

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

const TestOctokit = Octokit.plugin(paginateRest);
const octokit = new TestOctokit({
request: {
fetch: mock,
fetch: mock.fetchHandler,
},
});

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

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

Expand Down
Loading

0 comments on commit bea6327

Please sign in to comment.