mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Make root frame child components comply with open closed principle and include it in the behavioural unit tests Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make cluster frame child components comply with open closed principle and include it in behavioural unit tests Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove duplication Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Simplify test Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make a component more determistic in unit tests Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Mock uninterested, non-deterministic third party library in unit tests Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Optimize registration of injectables in unit tests to make tests faster Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Update snapshots Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove import time side-effect causing memory leak Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
/**
|
|
* 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 type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
|
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
|
import React from "react";
|
|
|
|
// TODO: Make components free of side effects by making them deterministic
|
|
jest.mock("../../renderer/components/tooltip/withTooltip", () => ({
|
|
withTooltip: (Target: any) => ({ tooltip, tooltipOverrideDisabled, ...props }: any) => <Target {...props} />,
|
|
}));
|
|
|
|
jest.mock("../../renderer/components/monaco-editor/monaco-editor", () => ({
|
|
MonacoEditor: () => null,
|
|
}));
|
|
|
|
describe("add-cluster - navigation using application menu", () => {
|
|
let applicationBuilder: ApplicationBuilder;
|
|
let rendered: RenderResult;
|
|
|
|
beforeEach(async () => {
|
|
applicationBuilder = getApplicationBuilder();
|
|
|
|
rendered = await applicationBuilder.render();
|
|
});
|
|
|
|
it("renders", () => {
|
|
expect(rendered.container).toMatchSnapshot();
|
|
});
|
|
|
|
it("does not show add cluster page yet", () => {
|
|
const actual = rendered.queryByTestId("add-cluster-page");
|
|
|
|
expect(actual).toBeNull();
|
|
});
|
|
|
|
describe("when navigating to add cluster using application menu", () => {
|
|
beforeEach(async () => {
|
|
await applicationBuilder.applicationMenu.click("file.add-cluster");
|
|
});
|
|
|
|
it("renders", () => {
|
|
expect(rendered.container).toMatchSnapshot();
|
|
});
|
|
|
|
it("shows add cluster page", () => {
|
|
const actual = rendered.getByTestId("add-cluster-page");
|
|
|
|
expect(actual).not.toBeNull();
|
|
});
|
|
});
|
|
});
|