1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/features/preferences/navigation-to-editor-preferences.test.ts
Janne Savolainen 63d5a34379
Replace static application window with ability to create many (#5979)
* Replace static application window with ability to create as many as you wish

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Adapt tests for replacing static application window with ability to create as many as you wish and separate starting of main and window in behaviours

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make first render of application smaller in test that proves to be hard for CI

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Remove redundant code

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Simplify code

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2022-08-16 15:55:42 +03:00

54 lines
1.6 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";
describe("preferences - navigation to editor preferences", () => {
let applicationBuilder: ApplicationBuilder;
beforeEach(() => {
applicationBuilder = getApplicationBuilder();
});
describe("given in preferences, when rendered", () => {
let rendered: RenderResult;
beforeEach(async () => {
applicationBuilder.beforeWindowStart(() => {
applicationBuilder.preferences.navigate();
});
rendered = await applicationBuilder.render();
});
it("renders", () => {
expect(rendered.container).toMatchSnapshot();
});
it("does not show editor preferences yet", () => {
const page = rendered.queryByTestId("editor-preferences-page");
expect(page).toBeNull();
});
describe("when navigating to editor preferences using navigation", () => {
beforeEach(() => {
applicationBuilder.preferences.navigation.click("editor");
});
it("renders", () => {
expect(rendered.container).toMatchSnapshot();
});
it("shows editor preferences", () => {
const page = rendered.getByTestId("editor-preferences-page");
expect(page).not.toBeNull();
});
});
});
});