mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add clusterModals tests
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
a6047899d6
commit
1a75247cfd
1031
src/features/cluster/__snapshots__/cluster-modal-items.test.tsx.snap
Normal file
1031
src/features/cluster/__snapshots__/cluster-modal-items.test.tsx.snap
Normal file
File diff suppressed because it is too large
Load Diff
57
src/features/cluster/cluster-modal-items.test.tsx
Normal file
57
src/features/cluster/cluster-modal-items.test.tsx
Normal file
@ -0,0 +1,57 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import { computed, runInAction } from "mobx";
|
||||
import React from "react";
|
||||
import { ClusterModalRegistration, clusterModalsInjectionToken } from "../../extensions/registries";
|
||||
import { ApplicationBuilder, getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
describe("cluster modal elements", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(() => {
|
||||
builder = getApplicationBuilder();
|
||||
|
||||
builder.setEnvironmentToClusterFrame();
|
||||
});
|
||||
|
||||
describe("given custom cluster modal available", () => {
|
||||
beforeEach(async () => {
|
||||
builder.beforeWindowStart((windowDi) => {
|
||||
runInAction(() => {
|
||||
windowDi.register(testClusterModalsInjectable);
|
||||
});
|
||||
});
|
||||
|
||||
rendered = await builder.render();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.container).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("given custom cluster modal not available", () => {
|
||||
beforeEach(async () => {
|
||||
rendered = await builder.render();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.container).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const testClusterModalsInjectable = getInjectable({
|
||||
id: "some-cluster-modal-injectable",
|
||||
|
||||
instantiate: () => {
|
||||
return computed((): ClusterModalRegistration[] => [{
|
||||
id: "test-modal-id",
|
||||
Component: () => <div data-testid="test-modal">test modal</div>,
|
||||
visible: computed(() => true),
|
||||
}])
|
||||
},
|
||||
|
||||
injectionToken: clusterModalsInjectionToken
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user