diff --git a/test/integration/smoke.test.ts b/test/integration/smoke.test.ts index 9fed5856..bbbe20eb 100644 --- a/test/integration/smoke.test.ts +++ b/test/integration/smoke.test.ts @@ -16,7 +16,7 @@ describe("Smoke tests", () => { it("userAgent option", () => { const mock = fetchMock - .sandbox() + .createInstance() .getOnce("https://api.github.com/", (_url, { headers }) => { // @ts-ignore headers has wrong typing in fetch-mock 8.3.2 expect(headers["user-agent"]).toMatch(/^my-app\/1.2.3 /); @@ -27,7 +27,7 @@ describe("Smoke tests", () => { const octokit = new Octokit({ userAgent: "my-app/1.2.3", request: { - fetch: mock, + fetch: mock.fetchHandler, }, }); return octokit.request("/"); @@ -35,12 +35,12 @@ describe("Smoke tests", () => { it("@octokit/plugin-rest-endpoint-methods", () => { const mock = fetchMock - .sandbox() + .createInstance() .getOnce("path:/repos/octocat/hello-world", { ok: true }); const octokit = new Octokit({ request: { - fetch: mock, + fetch: mock.fetchHandler, }, }); @@ -58,7 +58,7 @@ describe("Smoke tests", () => { it("@octokit/plugin-request-log", () => { const mock = fetchMock - .sandbox() + .createInstance() .getOnce("path:/", { status: 200, body: {} }) .getOnce("path:/", { status: 404, body: {} }, { overwriteRoutes: false }); @@ -72,7 +72,7 @@ describe("Smoke tests", () => { const octokit = new Octokit({ log: consoleStub, request: { - fetch: mock, + fetch: mock.fetchHandler, }, }); diff --git a/test/issues/881-redirect-url.test.ts b/test/issues/881-redirect-url.test.ts index f4d2248b..68d2b029 100644 --- a/test/issues/881-redirect-url.test.ts +++ b/test/issues/881-redirect-url.test.ts @@ -9,7 +9,7 @@ describe("https://github.com/octokit/rest.js/issues/881", () => { "https://issue-881-codeload.github.com/octocat/Hello-World/legacy.tar.gz/master"; const mock = fetchMock - .sandbox() + .createInstance() .headOnce( "https://api.github.com/repos/octocat/Hello-World/tarball/master", { @@ -20,7 +20,7 @@ describe("https://github.com/octokit/rest.js/issues/881", () => { const octokit = new Octokit({ request: { - fetch: mock, + fetch: mock.fetchHandler, }, });