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", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("file.add-cluster");
|
||||
applicationBuilder.menu.click("file.add-cluster");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
|
||||
@ -47,7 +47,7 @@ describe("extensions - navigation using application menu", () => {
|
||||
|
||||
describe("when navigating to extensions using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("root.extensions");
|
||||
applicationBuilder.menu.click("root.extensions");
|
||||
});
|
||||
|
||||
it("focuses the window", () => {
|
||||
|
||||
@ -48,7 +48,7 @@ describe("preferences - navigation using application menu", () => {
|
||||
|
||||
describe("when navigating to preferences using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("root.preferences");
|
||||
applicationBuilder.menu.click("root.preferences");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
|
||||
@ -32,7 +32,7 @@ describe("welcome - navigation using application menu", () => {
|
||||
|
||||
describe("when navigating to welcome using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("help.welcome");
|
||||
applicationBuilder.menu.click("help.welcome");
|
||||
});
|
||||
|
||||
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 type { MenuItemOpts } 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>;
|
||||
|
||||
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 {
|
||||
dis: DiContainers;
|
||||
setEnvironmentToClusterFrame: () => ApplicationBuilder;
|
||||
addExtensions: (...extensions: LensRendererExtension[]) => Promise<ApplicationBuilder>;
|
||||
allowKubeResource: (resourceName: KubeResource) => ApplicationBuilder;
|
||||
beforeSetups: (callback: Callback) => ApplicationBuilder;
|
||||
beforeRender: (callback: Callback) => ApplicationBuilder;
|
||||
render: () => Promise<RenderResult>;
|
||||
|
||||
applicationMenu: {
|
||||
click: (path: string) => void;
|
||||
};
|
||||
|
||||
preferences: {
|
||||
close: () => void;
|
||||
navigate: () => void;
|
||||
navigation: {
|
||||
click: (id: string) => void;
|
||||
};
|
||||
};
|
||||
readonly dis: DiContainers;
|
||||
readonly menu: ApplicationMenu;
|
||||
readonly preferences: ApplicationPreferences;
|
||||
readonly actions: ApplicationActions;
|
||||
}
|
||||
|
||||
interface DiContainers {
|
||||
@ -121,13 +129,19 @@ export const getApplicationBuilder = () => {
|
||||
computed((): LensMainExtension[] => []),
|
||||
);
|
||||
|
||||
const showAbout = jest.fn();
|
||||
|
||||
mainDi.override(showAboutInjectable, () => showAbout);
|
||||
|
||||
let allowedResourcesState: IObservableArray<KubeResource>;
|
||||
let rendered: RenderResult;
|
||||
|
||||
const builder: ApplicationBuilder = {
|
||||
dis,
|
||||
|
||||
applicationMenu: {
|
||||
actions: {
|
||||
showAbout,
|
||||
},
|
||||
menu: {
|
||||
click: (path: string) => {
|
||||
const applicationMenuItems = mainDi.inject(
|
||||
applicationMenuItemsInjectable,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user