From a6add7a4c5b6a4923fb996b8ff8f71f8d3cfcb91 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 3 Apr 2023 19:51:31 +0200 Subject: [PATCH] fake tray and fake menu parity Signed-off-by: Gabriel --- ...update-using-application-menu.test.ts.snap | 286 ++++++++++++++++++ ...tion-update-using-application-menu.test.ts | 28 +- .../installing-update-using-tray.test.ts | 1 - 3 files changed, 304 insertions(+), 11 deletions(-) create mode 100644 packages/core/src/features/application-update/child-features/application-update-using-application-menu/__snapshots__/application-update-using-application-menu.test.ts.snap diff --git a/packages/core/src/features/application-update/child-features/application-update-using-application-menu/__snapshots__/application-update-using-application-menu.test.ts.snap b/packages/core/src/features/application-update/child-features/application-update-using-application-menu/__snapshots__/application-update-using-application-menu.test.ts.snap new file mode 100644 index 0000000000..3f42fc9c92 --- /dev/null +++ b/packages/core/src/features/application-update/child-features/application-update-using-application-menu/__snapshots__/application-update-using-application-menu.test.ts.snap @@ -0,0 +1,286 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`installing update using application menu when started renders 1`] = ` + +
+
+
+
+
+ + + home + + +
+
+
+ + + arrow_back + + +
+
+
+ + + arrow_forward + + +
+
+
+
+
+
+
+
+ +
+
+

+ Welcome to some-product-name! +

+

+ To get you started we have auto-detected your clusters in your + + kubeconfig file and added them to the catalog, your centralized + + view for managing all your cloud-native resources. +
+
+ If you have any questions or feedback, please join our + + Lens Forums + + . +

+ +
+
+
+
+
+
+
+
+
+
+
+ Ca +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + arrow_left + + +
+
+ 1 +
+
+ + + arrow_right + + +
+
+
+
+
+
+
+
+
+ +`; diff --git a/packages/core/src/features/application-update/child-features/application-update-using-application-menu/application-update-using-application-menu.test.ts b/packages/core/src/features/application-update/child-features/application-update-using-application-menu/application-update-using-application-menu.test.ts index fbb3820860..755fe16664 100644 --- a/packages/core/src/features/application-update/child-features/application-update-using-application-menu/application-update-using-application-menu.test.ts +++ b/packages/core/src/features/application-update/child-features/application-update-using-application-menu/application-update-using-application-menu.test.ts @@ -10,10 +10,13 @@ import type { ApplicationBuilder } from "../../../../renderer/components/test-ut import type { CheckForPlatformUpdates } from "../../main/check-for-updates/check-for-platform-updates/check-for-platform-updates.injectable"; import checkForPlatformUpdatesInjectable from "../../main/check-for-updates/check-for-platform-updates/check-for-platform-updates.injectable"; import type { RenderResult } from "@testing-library/react"; +import showMessagePopupInjectable from "../../../../main/electron-app/features/show-message-popup.injectable"; +import type { ShowMessagePopup } from "../../../../main/electron-app/features/show-message-popup.injectable"; describe("installing update using application menu", () => { let applicationBuilder: ApplicationBuilder; let checkForPlatformUpdatesMock: AsyncFnMock; + let showMessagePopupMock: AsyncFnMock; beforeEach(() => { applicationBuilder = getApplicationBuilder(); @@ -23,6 +26,11 @@ describe("installing update using application menu", () => { checkForPlatformUpdatesInjectable, () => checkForPlatformUpdatesMock, ); + + mainDi.override( + showMessagePopupInjectable, + () => showMessagePopupMock, + ); }); }); @@ -41,7 +49,7 @@ describe("installing update using application menu", () => { beforeEach(() => { applicationBuilder.applicationMenu.click( "root", - "mac", + "help", "check-for-updates", ); }); @@ -52,15 +60,15 @@ describe("installing update using application menu", () => { }); }); - // it displays a popup - // showMessagePopup( - // "No Updates Available", - // "You're all good", - // "You've got the latest version of Lens,\nthanks for staying on the ball.", - // { - // textWidth: 300, - // }, - // ); + it("it displays a popup", () => { + expect(showMessagePopupMock).toHaveBeenCalledWith( + "No Updates Available", + "You're all good", + "You've got the latest version of Lens,\nthanks for staying on the ball.", + { "textWidth": 300 } + ); + }); + }); }); }); diff --git a/packages/core/src/features/application-update/child-features/application-update-using-tray/installing-update-using-tray.test.ts b/packages/core/src/features/application-update/child-features/application-update-using-tray/installing-update-using-tray.test.ts index 64095a2a91..25476e08ec 100644 --- a/packages/core/src/features/application-update/child-features/application-update-using-tray/installing-update-using-tray.test.ts +++ b/packages/core/src/features/application-update/child-features/application-update-using-tray/installing-update-using-tray.test.ts @@ -175,7 +175,6 @@ describe("installing update using tray", () => { }); it("it displays a popup", () => { - expect(showMessagePopupMock).toHaveBeenCalled(); expect(showMessagePopupMock).toHaveBeenCalledWith( "No Updates Available", "You're all good",