From afcdda78ffadf33a1dc30a18f932304beab3d224 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 3 Apr 2023 20:09:30 +0200 Subject: [PATCH] tray and menu passing tests and lint Signed-off-by: Gabriel --- ...tion-update-using-application-menu.test.ts | 24 ++++++++++++------- .../installing-update-using-tray.test.ts | 12 +++++----- 2 files changed, 22 insertions(+), 14 deletions(-) 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 755fe16664..f8edecd81b 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 @@ -12,6 +12,10 @@ import checkForPlatformUpdatesInjectable from "../../main/check-for-updates/chec 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"; +import electronUpdaterIsActiveInjectable + from "../../../../main/electron-app/features/electron-updater-is-active.injectable"; +import publishIsConfiguredInjectable + from "../../main/updating-is-enabled/publish-is-configured/publish-is-configured.injectable"; describe("installing update using application menu", () => { let applicationBuilder: ApplicationBuilder; @@ -22,14 +26,19 @@ describe("installing update using application menu", () => { applicationBuilder = getApplicationBuilder(); applicationBuilder.beforeApplicationStart(({ mainDi }) => { checkForPlatformUpdatesMock = asyncFn(); + showMessagePopupMock = asyncFn(); + mainDi.override( checkForPlatformUpdatesInjectable, () => checkForPlatformUpdatesMock, ); + mainDi.override(electronUpdaterIsActiveInjectable, () => true); + mainDi.override(publishIsConfiguredInjectable, () => true); + mainDi.override( - showMessagePopupInjectable, - () => showMessagePopupMock, + showMessagePopupInjectable, + () => showMessagePopupMock, ); }); }); @@ -49,7 +58,7 @@ describe("installing update using application menu", () => { beforeEach(() => { applicationBuilder.applicationMenu.click( "root", - "help", + "mac", "check-for-updates", ); }); @@ -62,13 +71,12 @@ describe("installing update using application menu", () => { 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 } + "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 25476e08ec..29f6cdbe48 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 @@ -46,8 +46,8 @@ describe("installing update using tray", () => { mainDi.override(publishIsConfiguredInjectable, () => true); mainDi.override( - showMessagePopupInjectable, - () => showMessagePopupMock, + showMessagePopupInjectable, + () => showMessagePopupMock, ); }); @@ -176,10 +176,10 @@ describe("installing update using tray", () => { 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 } + "No Updates Available", + "You're all good", + "You've got the latest version of Lens,\nthanks for staying on the ball.", + { "textWidth": 300 }, ); });