2023-01-27 18:59:14 +01:00
|
|
|
import fs from "fs"
|
2023-11-20 21:52:29 +01:00
|
|
|
|
2023-01-27 18:59:14 +01:00
|
|
|
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
|
|
|
|
}
|