mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix build for integration tests
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
9718837784
commit
90094641ba
@ -21,7 +21,8 @@ import { flushPromises } from "../../test-utils/flush-promises";
|
||||
import createKubeJsonApiInjectable from "../create-kube-json-api.injectable";
|
||||
import type { IKubeWatchEvent } from "../kube-watch-event";
|
||||
import type { KubeJsonApiDataFor } from "../kube-object";
|
||||
import type { Response, Headers as NodeFetchHeaders } from "node-fetch";
|
||||
import { Headers as NodeFetchHeaders } from "node-fetch";
|
||||
import type { Response } from "node-fetch";
|
||||
import AbortController from "abort-controller";
|
||||
|
||||
const createMockResponseFromString = (url: string, data: string, statusCode = 200) => {
|
||||
@ -32,8 +33,7 @@ const createMockResponseFromString = (url: string, data: string, statusCode = 20
|
||||
blob: jest.fn(async () => { throw new Error("blob() is not supported"); }),
|
||||
body: new PassThrough(),
|
||||
bodyUsed: false,
|
||||
formData: jest.fn(async () => { throw new Error("formData() is not supported"); }),
|
||||
headers: new Headers() as NodeFetchHeaders,
|
||||
headers: new NodeFetchHeaders(),
|
||||
json: jest.fn(async () => JSON.parse(await res.text())),
|
||||
ok: 200 <= statusCode && statusCode < 300,
|
||||
redirected: 300 <= statusCode && statusCode < 400,
|
||||
@ -43,6 +43,8 @@ const createMockResponseFromString = (url: string, data: string, statusCode = 20
|
||||
text: jest.fn(async () => data),
|
||||
type: "basic",
|
||||
url,
|
||||
textConverted: jest.fn(async () => { throw new Error("textConverted() is not supported"); }),
|
||||
timeout: 0,
|
||||
};
|
||||
|
||||
return res;
|
||||
@ -56,8 +58,7 @@ const createMockResponseFromStream = (url: string, stream: NodeJS.ReadableStream
|
||||
blob: jest.fn(async () => { throw new Error("blob() is not supported"); }),
|
||||
body: stream,
|
||||
bodyUsed: false,
|
||||
formData: jest.fn(async () => { throw new Error("formData() is not supported"); }),
|
||||
headers: new Headers() as NodeFetchHeaders,
|
||||
headers: new NodeFetchHeaders(),
|
||||
json: jest.fn(async () => JSON.parse(await res.text())),
|
||||
ok: 200 <= statusCode && statusCode < 300,
|
||||
redirected: 300 <= statusCode && statusCode < 400,
|
||||
@ -75,6 +76,8 @@ const createMockResponseFromStream = (url: string, stream: NodeJS.ReadableStream
|
||||
}),
|
||||
type: "basic",
|
||||
url,
|
||||
textConverted: jest.fn(async () => { throw new Error("textConverted() is not supported"); }),
|
||||
timeout: 0,
|
||||
};
|
||||
|
||||
return res;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user