mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix behavioural test
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
41c88c424d
commit
a32a1ad5cb
@ -36,7 +36,7 @@ describe("add-cluster - navigation using application menu", () => {
|
|||||||
|
|
||||||
describe("when navigating to add cluster using application menu", () => {
|
describe("when navigating to add cluster using application menu", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
applicationBuilder.applicationMenu.click("file.add-cluster");
|
applicationBuilder.menu.click("file.add-cluster");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
|
|||||||
@ -47,7 +47,7 @@ describe("extensions - navigation using application menu", () => {
|
|||||||
|
|
||||||
describe("when navigating to extensions using application menu", () => {
|
describe("when navigating to extensions using application menu", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
applicationBuilder.applicationMenu.click("root.extensions");
|
applicationBuilder.menu.click("root.extensions");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("focuses the window", () => {
|
it("focuses the window", () => {
|
||||||
|
|||||||
@ -48,7 +48,7 @@ describe("preferences - navigation using application menu", () => {
|
|||||||
|
|
||||||
describe("when navigating to preferences using application menu", () => {
|
describe("when navigating to preferences using application menu", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
applicationBuilder.applicationMenu.click("root.preferences");
|
applicationBuilder.menu.click("root.preferences");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
|
|||||||
@ -32,7 +32,7 @@ describe("welcome - navigation using application menu", () => {
|
|||||||
|
|
||||||
describe("when navigating to welcome using application menu", () => {
|
describe("when navigating to welcome using application menu", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
applicationBuilder.applicationMenu.click("help.welcome");
|
applicationBuilder.menu.click("help.welcome");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
|
|||||||
@ -33,29 +33,37 @@ import preferenceNavigationItemsInjectable from "../+preferences/preferences-nav
|
|||||||
import navigateToPreferencesInjectable from "../../../common/front-end-routing/routes/preferences/navigate-to-preferences.injectable";
|
import navigateToPreferencesInjectable from "../../../common/front-end-routing/routes/preferences/navigate-to-preferences.injectable";
|
||||||
import type { MenuItemOpts } from "../../../main/menu/application-menu-items.injectable";
|
import type { MenuItemOpts } from "../../../main/menu/application-menu-items.injectable";
|
||||||
import applicationMenuItemsInjectable from "../../../main/menu/application-menu-items.injectable";
|
import applicationMenuItemsInjectable from "../../../main/menu/application-menu-items.injectable";
|
||||||
|
import showAboutInjectable from "../../../main/menu/show-about.injectable";
|
||||||
|
|
||||||
type Callback = (dis: DiContainers) => void | Promise<void>;
|
type Callback = (dis: DiContainers) => void | Promise<void>;
|
||||||
|
|
||||||
|
export interface ApplicationMenu {
|
||||||
|
click: (path: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationPreferences {
|
||||||
|
close: () => void;
|
||||||
|
navigate: () => void;
|
||||||
|
navigation: {
|
||||||
|
click: (id: string) => void;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationActions {
|
||||||
|
showAbout: jest.MockedFunction<() => void>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ApplicationBuilder {
|
export interface ApplicationBuilder {
|
||||||
dis: DiContainers;
|
|
||||||
setEnvironmentToClusterFrame: () => ApplicationBuilder;
|
setEnvironmentToClusterFrame: () => ApplicationBuilder;
|
||||||
addExtensions: (...extensions: LensRendererExtension[]) => Promise<ApplicationBuilder>;
|
addExtensions: (...extensions: LensRendererExtension[]) => Promise<ApplicationBuilder>;
|
||||||
allowKubeResource: (resourceName: KubeResource) => ApplicationBuilder;
|
allowKubeResource: (resourceName: KubeResource) => ApplicationBuilder;
|
||||||
beforeSetups: (callback: Callback) => ApplicationBuilder;
|
beforeSetups: (callback: Callback) => ApplicationBuilder;
|
||||||
beforeRender: (callback: Callback) => ApplicationBuilder;
|
beforeRender: (callback: Callback) => ApplicationBuilder;
|
||||||
render: () => Promise<RenderResult>;
|
render: () => Promise<RenderResult>;
|
||||||
|
readonly dis: DiContainers;
|
||||||
applicationMenu: {
|
readonly menu: ApplicationMenu;
|
||||||
click: (path: string) => void;
|
readonly preferences: ApplicationPreferences;
|
||||||
};
|
readonly actions: ApplicationActions;
|
||||||
|
|
||||||
preferences: {
|
|
||||||
close: () => void;
|
|
||||||
navigate: () => void;
|
|
||||||
navigation: {
|
|
||||||
click: (id: string) => void;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DiContainers {
|
interface DiContainers {
|
||||||
@ -121,13 +129,19 @@ export const getApplicationBuilder = () => {
|
|||||||
computed((): LensMainExtension[] => []),
|
computed((): LensMainExtension[] => []),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const showAbout = jest.fn();
|
||||||
|
|
||||||
|
mainDi.override(showAboutInjectable, () => showAbout);
|
||||||
|
|
||||||
let allowedResourcesState: IObservableArray<KubeResource>;
|
let allowedResourcesState: IObservableArray<KubeResource>;
|
||||||
let rendered: RenderResult;
|
let rendered: RenderResult;
|
||||||
|
|
||||||
const builder: ApplicationBuilder = {
|
const builder: ApplicationBuilder = {
|
||||||
dis,
|
dis,
|
||||||
|
actions: {
|
||||||
applicationMenu: {
|
showAbout,
|
||||||
|
},
|
||||||
|
menu: {
|
||||||
click: (path: string) => {
|
click: (path: string) => {
|
||||||
const applicationMenuItems = mainDi.inject(
|
const applicationMenuItems = mainDi.inject(
|
||||||
applicationMenuItemsInjectable,
|
applicationMenuItemsInjectable,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user