diff --git a/src/features/cluster/__snapshots__/workload-overview.test.tsx.snap b/src/features/cluster/__snapshots__/workload-overview.test.tsx.snap new file mode 100644 index 0000000000..1f1b142ad8 --- /dev/null +++ b/src/features/cluster/__snapshots__/workload-overview.test.tsx.snap @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`workload overview when navigating to workload overview renders 1`] = ` + +
+
+ +
+
+ + +
+
+
+
+
+ Overview +
+
+
+ + +
+
+
+ All namespaces +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +`; diff --git a/src/features/cluster/workload-overview.test.tsx b/src/features/cluster/workload-overview.test.tsx new file mode 100644 index 0000000000..27eb2823d8 --- /dev/null +++ b/src/features/cluster/workload-overview.test.tsx @@ -0,0 +1,37 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +import type { RenderResult } from "@testing-library/react"; +import navigateToWorkloadsOverviewInjectable from "../../common/front-end-routing/routes/cluster/workloads/overview/navigate-to-workloads-overview.injectable"; +import { type ApplicationBuilder, getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; + +describe("workload overview", () => { + let rendered: RenderResult; + let applicationBuilder: ApplicationBuilder; + + beforeEach(async () => { + applicationBuilder = getApplicationBuilder().setEnvironmentToClusterFrame(); + applicationBuilder.allowKubeResource("pods"); + rendered = await applicationBuilder.render(); + }); + + describe("when navigating to workload overview", () => { + beforeEach(() => { + applicationBuilder.navigateWith(navigateToWorkloadsOverviewInjectable); + }); + + it("renders", () => { + expect(rendered.baseElement).toMatchSnapshot(); + }); + + it("does not yet show workload overview", () => { + expect(rendered.queryByTestId("page-for-workloads-overview")).toBeInTheDocument(); + }); + + it("shows pods pie chart", () => { + expect(rendered.queryByTestId("workload-overview-status-chart-pods")).toBeInTheDocument(); + }); + }); +}); diff --git a/src/renderer/components/test-utils/get-application-builder.tsx b/src/renderer/components/test-utils/get-application-builder.tsx index 404a8d421a..5ca3c5975f 100644 --- a/src/renderer/components/test-utils/get-application-builder.tsx +++ b/src/renderer/components/test-utils/get-application-builder.tsx @@ -442,7 +442,8 @@ export const getApplicationBuilder = () => { }, navigateWith: (token) => { - const navigate = rendererDi.inject(token); + const windowDi = builder.applicationWindow.only.di; + const navigate = windowDi.inject(token); navigate(); },