Fix googlesheets.spec.ts's reliance on the node-fetch mock.
This commit is contained in:
parent
9a2e8031bc
commit
3657067337
|
@ -1,4 +1,5 @@
|
||||||
import type { GoogleSpreadsheetWorksheet } from "google-spreadsheet"
|
import type { GoogleSpreadsheetWorksheet } from "google-spreadsheet"
|
||||||
|
import nock from "nock"
|
||||||
|
|
||||||
jest.mock("google-auth-library")
|
jest.mock("google-auth-library")
|
||||||
const { OAuth2Client } = require("google-auth-library")
|
const { OAuth2Client } = require("google-auth-library")
|
||||||
|
@ -62,30 +63,15 @@ describe("Google Sheets Integration", () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
|
||||||
jest.clearAllMocks()
|
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 {
|
function createBasicTable(name: string, columns: string[]): Table {
|
||||||
return {
|
return {
|
||||||
type: "table",
|
type: "table",
|
||||||
|
|
Loading…
Reference in New Issue