Skip to content

chore(deps): update dependency fetch-mock to v12 #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 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 @@ -35,7 +35,7 @@
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^3.0.0",
"esbuild": "^0.24.0",
"fetch-mock": "^11.0.0",
"fetch-mock": "^12.0.0",
"glob": "^10.2.6",
"prettier": "3.4.2",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
Expand Down
18 changes: 12 additions & 6 deletions test/paginate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ describe("pagination", () => {
],
};
const mock = fetchMock
.sandbox()
.createInstance()
.post("https://api.github.com/graphql", mockResponse);

const octokit = new PatchedOctokit({ request: { fetch: mock } });
const octokit = new PatchedOctokit({
request: { fetch: mock.fetchHandler },
});
const query = `{
viewer {
bioHtml
Expand All @@ -398,11 +400,15 @@ describe("pagination", () => {
});

it(".paginate() passes 500 errors on.", async (): Promise<void> => {
const mock = fetchMock.sandbox().post("https://api.github.com/graphql", {
status: 500,
});
const mock = fetchMock
.createInstance()
.post("https://api.github.com/graphql", {
status: 500,
});

const octokit = new PatchedOctokit({ request: { fetch: mock } });
const octokit = new PatchedOctokit({
request: { fetch: mock.fetchHandler },
});
const func = async () =>
await octokit.graphql.paginate<TestResponseType>(`
query paginate($cursor: String) {
Expand Down
6 changes: 3 additions & 3 deletions test/testHelpers/mock-octokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const MockOctokit = ({ responses = [{}] }: { responses?: any[] } = {}) => {
let calledQueries: string[] = [];
let passedVariables: any[] = [];
let callCount = 0;
const mock = fetchMock.sandbox().post(
const mock = fetchMock.createInstance().post(
"https://api.github.com/graphql",
(_, options) => {
({ options }) => {
calledQueries.push(JSON.parse(options.body!.toString()).query);
passedVariables.push(JSON.parse(options.body!.toString()).variables);
callCount = callCount + 1;
Expand All @@ -21,7 +21,7 @@ const MockOctokit = ({ responses = [{}] }: { responses?: any[] } = {}) => {

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

Expand Down