chore: Fix lint after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-06-01 11:54:24 -04:00
1 parent 69324ff555
commit 369f934159
11 files changed
+67 -46

No files matched your search

@@ -7,7 +7,7 @@ import { KubeJsonApi, DeploymentApi } from "@k8slens/kube-api";
describe("DeploymentApi", () => {
let deploymentApi: DeploymentApi;
let kubeJsonApi: jest.Mocked<KubeJsonApi>;
let kubeJsonApi: KubeJsonApi;
beforeEach(() => {
kubeJsonApi = {
@@ -17,14 +17,16 @@ describe("DeploymentApi", () => {
put: jest.fn(),
patch: jest.fn(),
del: jest.fn(),
} as never;
} as Partial<KubeJsonApi> as KubeJsonApi;
deploymentApi = new DeploymentApi({
logger: {
info: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
} as any,
silly: jest.fn(),
warn: jest.fn(),
},
maybeKubeApi: kubeJsonApi,
});
});
@@ -33,6 +35,7 @@ describe("DeploymentApi", () => {
it("requests Kubernetes API with PATCH verb and correct amount of replicas", async () => {
await deploymentApi.scale({ namespace: "default", name: "deployment-1" }, 5);
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(kubeJsonApi.patch).toHaveBeenCalledWith(
"/apis/apps/v1/namespaces/default/deployments/deployment-1/scale",
{
@@ -26,7 +26,9 @@ describe("StatefulSetApi", () => {
info: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
} as any,
silly: jest.fn(),
warn: jest.fn(),
},
maybeKubeApi: kubeJsonApi,
});
});
@@ -60,7 +62,9 @@ describe("StatefulSetApi", () => {
const req = statefulSetApi.getReplicas({ namespace: "default", name: "statefulset-1" });
await flushPromises();
expect(kubeJsonApi.get).toHaveBeenCalledWith("/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale");
expect(kubeJsonApiGetMock).toHaveBeenCalledWith(
"/apis/apps/v1/namespaces/default/statefulsets/statefulset-1/scale",
);
await kubeJsonApiGetMock.resolve({ status: { replicas: 10 } });
expect(await req).toBe(10);
@@ -28,7 +28,9 @@ describe("KubeApi", () => {
info: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
} as any;
silly: jest.fn(),
warn: jest.fn(),
};
kubeJsonApi = new KubeJsonApi(
{
@@ -20,7 +20,7 @@ export const createMockResponseFromString = (url: string, data: string, statusCo
body: new PassThrough(),
bodyUsed: false,
headers: new NodeFetchHeaders(),
json: jest.fn(async () => JSON.parse(await res.text())),
json: jest.fn(async () => JSON.parse(await res.text()) as unknown),
ok: 200 <= statusCode && statusCode < 300,
redirected: 300 <= statusCode && statusCode < 400,
size: data.length,
@@ -52,7 +52,7 @@ export const createMockResponseFromStream = (url: string, stream: NodeJS.Readabl
body: stream,
bodyUsed: false,
headers: new NodeFetchHeaders(),
json: jest.fn(async () => JSON.parse(await res.text())),
json: jest.fn(async () => JSON.parse(await res.text()) as unknown),
ok: 200 <= statusCode && statusCode < 300,
redirected: 300 <= statusCode && statusCode < 400,
size: 10,
@@ -62,7 +62,7 @@ export const createMockResponseFromStream = (url: string, stream: NodeJS.Readabl
const chunks: Buffer[] = [];
return new Promise((resolve, reject) => {
stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
stream.on("data", (chunk) => chunks.push(Buffer.from(chunk as [])));
stream.on("error", (err) => reject(err));
stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
});