From 3657067337cef5c66e5ded487d4d17a60d5c910c Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 1 Aug 2024 11:44:58 +0100 Subject: [PATCH] Fix googlesheets.spec.ts's reliance on the node-fetch mock. --- .../integrations/tests/googlesheets.spec.ts | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/packages/server/src/integrations/tests/googlesheets.spec.ts b/packages/server/src/integrations/tests/googlesheets.spec.ts index 2252a8bb9b..9b1ea815f5 100644 --- a/packages/server/src/integrations/tests/googlesheets.spec.ts +++ b/packages/server/src/integrations/tests/googlesheets.spec.ts @@ -1,4 +1,5 @@ import type { GoogleSpreadsheetWorksheet } from "google-spreadsheet" +import nock from "nock" jest.mock("google-auth-library") const { OAuth2Client } = require("google-auth-library") @@ -62,30 +63,15 @@ describe("Google Sheets Integration", () => { await config.init() jest.clearAllMocks() + + nock.cleanAll() + nock("https://www.googleapis.com/").post("/oauth2/v4/token").reply(200, { + grant_type: "client_credentials", + client_id: "your-client-id", + client_secret: "your-client-secret", + }) }) - // nock("https://www.googleapis.com/").post("/oauth2/v4/token").reply(200, { - // grant_type: "client_credentials", - // client_id: "your-client-id", - // client_secret: "your-client-secret", - // }) - - // nock("https://oauth2.googleapis.com").post("/token").reply(200, { - // access_token: "your-access-token", - // }) - - // nock("https://sheets.googleapis.com") - // .get("/v4/spreadsheets/randomId/") - // .reply(200, { - // sheets: [ - // { - // properties: { - // title: "test", - // }, - // }, - // ], - // }) - function createBasicTable(name: string, columns: string[]): Table { return { type: "table",