1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00
budibase/packages/worker/__mocks__/node-fetch.ts
2023-11-20 21:52:29 +01:00

25 lines
554 B
TypeScript

import fs from "fs"
module FetchMock {
const fetch = jest.requireActual("node-fetch")
const func = async (url: any, opts: any) => {
if (url.includes("http://someconfigurl")) {
return {
ok: true,
json: () => ({
issuer: "test",
authorization_endpoint: "http://localhost/auth",
token_endpoint: "http://localhost/token",
userinfo_endpoint: "http://localhost/userinfo",
}),
}
}
return fetch(url, opts)
}
func.Headers = fetch.Headers
module.exports = func
}