diff --git a/src/behaviours/update-app/installing-update-using-tray.test.ts b/src/behaviours/update-app/installing-update-using-tray.test.ts index a1961daef3..dfd8fa817b 100644 --- a/src/behaviours/update-app/installing-update-using-tray.test.ts +++ b/src/behaviours/update-app/installing-update-using-tray.test.ts @@ -19,6 +19,7 @@ import selectedUpdateChannelInjectable from "../../main/update-app/selected-upda import progressOfUpdateDownloadInjectable from "../../main/update-app/progress-of-update-download.injectable"; import type { IComputedValue } from "mobx"; import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-update-on-quit.injectable"; +import showApplicationWindowInjectable from "../../main/start-main-application/lens-window/show-application-window.injectable"; describe("installing update using tray", () => { let applicationBuilder: ApplicationBuilder; @@ -26,6 +27,7 @@ describe("installing update using tray", () => { let checkForPlatformUpdatesMock: AsyncFnMock; let downloadPlatformUpdateMock: AsyncFnMock<() => void>; let setUpdateOnQuitMock: jest.Mock; + let showApplicationWindowMock: jest.Mock; beforeEach(() => { applicationBuilder = getApplicationBuilder(); @@ -35,6 +37,9 @@ describe("installing update using tray", () => { checkForPlatformUpdatesMock = asyncFn(); downloadPlatformUpdateMock = asyncFn(); setUpdateOnQuitMock = jest.fn(); + showApplicationWindowMock = jest.fn(); + + mainDi.override(showApplicationWindowInjectable, () => showApplicationWindowMock); mainDi.override(setUpdateOnQuitInjectable, () => setUpdateOnQuitMock); @@ -87,6 +92,10 @@ describe("installing update using tray", () => { ); }); + it("does not show application window yet", () => { + expect(showApplicationWindowMock).not.toHaveBeenCalled(); + }); + xit("notifies the user that checking for updates is happening", () => {}); it("user cannot check for updates again", () => { @@ -118,6 +127,10 @@ describe("installing update using tray", () => { await checkForUpdatesPromise; }); + it("shows application window", () => { + expect(showApplicationWindowMock).toHaveBeenCalled(); + }); + xit("notifies the user", () => {}); it("does not start downloading update", () => { @@ -155,6 +168,10 @@ describe("installing update using tray", () => { await checkForUpdatesPromise; }); + it("shows application window", () => { + expect(showApplicationWindowMock).toHaveBeenCalled(); + }); + it("starts downloading the update", () => { expect(downloadPlatformUpdateMock).toHaveBeenCalled(); }); diff --git a/src/main/update-app/check-for-updates-tray-item.injectable.ts b/src/main/update-app/check-for-updates-tray-item.injectable.ts index 1009edc408..cb56962c90 100644 --- a/src/main/update-app/check-for-updates-tray-item.injectable.ts +++ b/src/main/update-app/check-for-updates-tray-item.injectable.ts @@ -44,11 +44,11 @@ const checkForUpdatesTrayItemInjectable = getInjectable({ const { updateWasDiscovered } = await versionUpdate.checkForUpdates(); if (updateWasDiscovered) { + // Note: intentional orphan promise to make download happen in the background versionUpdate.downloadUpdate(); } - - // await showApplicationWindow(); + await showApplicationWindow(); }, }; },