diff --git a/src/behaviours/application-update/checking-for-updates-automatically.test.ts b/src/behaviours/application-update/checking-for-updates-automatically.test.ts index f06608b617..0328d10fe2 100644 --- a/src/behaviours/application-update/checking-for-updates-automatically.test.ts +++ b/src/behaviours/application-update/checking-for-updates-automatically.test.ts @@ -9,15 +9,14 @@ import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/ import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable"; import type { AsyncFnMock } from "@async-fn/jest"; import asyncFn from "@async-fn/jest"; -import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable"; -import startCheckingForUpdatesInjectable - from "../../main/application-update/periodical-check-for-updates/start-checking-for-updates.injectable"; +import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable"; +import startCheckingForUpdatesInjectable from "../../main/application-update/periodical-check-for-updates/start-checking-for-updates.injectable"; const ENOUGH_TIME = 1000 * 60 * 60 * 2; describe("checking for updates automatically", () => { let applicationBuilder: ApplicationBuilder; - let checkForUpdatesMock: AsyncFnMock<() => Promise>; + let processCheckingForUpdatesMock: AsyncFnMock<() => Promise>; beforeEach(() => { jest.useFakeTimers(); @@ -27,11 +26,11 @@ describe("checking for updates automatically", () => { applicationBuilder.beforeApplicationStart(({ mainDi }) => { mainDi.unoverride(startCheckingForUpdatesInjectable); - checkForUpdatesMock = asyncFn(); + processCheckingForUpdatesMock = asyncFn(); mainDi.override( - checkForUpdatesInjectable, - () => checkForUpdatesMock, + processCheckingForUpdatesInjectable, + () => processCheckingForUpdatesMock, ); }); }); @@ -53,23 +52,23 @@ describe("checking for updates automatically", () => { }); it("checks for updates", () => { - expect(checkForUpdatesMock).toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).toHaveBeenCalled(); }); it("when just not enough time passes, does not check for updates again automatically yet", () => { - checkForUpdatesMock.mockClear(); + processCheckingForUpdatesMock.mockClear(); jest.advanceTimersByTime(ENOUGH_TIME - 1); - expect(checkForUpdatesMock).not.toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).not.toHaveBeenCalled(); }); it("when just enough time passes, checks for updates again automatically", () => { - checkForUpdatesMock.mockClear(); + processCheckingForUpdatesMock.mockClear(); jest.advanceTimersByTime(ENOUGH_TIME); - expect(checkForUpdatesMock).toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).toHaveBeenCalled(); }); }); @@ -84,13 +83,13 @@ describe("checking for updates automatically", () => { }); it("does not check for updates", () => { - expect(checkForUpdatesMock).not.toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).not.toHaveBeenCalled(); }); it("when enough time passes for checking updates again, still does not check for updates", () => { jest.advanceTimersByTime(ENOUGH_TIME); - expect(checkForUpdatesMock).not.toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).not.toHaveBeenCalled(); }); }); @@ -105,13 +104,13 @@ describe("checking for updates automatically", () => { }); it("does not check for updates", () => { - expect(checkForUpdatesMock).not.toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).not.toHaveBeenCalled(); }); it("when enough time passes for checking updates again, still does not check for updates", () => { jest.advanceTimersByTime(ENOUGH_TIME); - expect(checkForUpdatesMock).not.toHaveBeenCalled(); + expect(processCheckingForUpdatesMock).not.toHaveBeenCalled(); }); }); }); diff --git a/src/behaviours/application-update/downgrading-version-update.test.ts b/src/behaviours/application-update/downgrading-version-update.test.ts index 5af35f3627..e8e5635fb3 100644 --- a/src/behaviours/application-update/downgrading-version-update.test.ts +++ b/src/behaviours/application-update/downgrading-version-update.test.ts @@ -10,7 +10,7 @@ import type { AsyncFnMock } from "@async-fn/jest"; import asyncFn from "@async-fn/jest"; import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable"; import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable"; -import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable"; +import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable"; import selectedUpdateChannelInjectable from "../../common/application-update/selected-update-channel/selected-update-channel.injectable"; import type { DiContainer } from "@ogre-tools/injectable"; import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable"; @@ -77,9 +77,9 @@ describe("downgrading version update", () => { selectedUpdateChannel.setValue(updateChannel.id); - const checkForUpdates = mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(expect.any(Object), { allowDowngrade: downgradeIsAllowed }); }); diff --git a/src/behaviours/application-update/installing-update-from-update-channels.test.ts b/src/behaviours/application-update/installing-update-from-update-channels.test.ts index 5284cc367f..f98f65ab3b 100644 --- a/src/behaviours/application-update/installing-update-from-update-channels.test.ts +++ b/src/behaviours/application-update/installing-update-from-update-channels.test.ts @@ -22,9 +22,8 @@ import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-upda import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable"; import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable"; import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable"; -import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable"; -import appVersionInjectable - from "../../common/get-configuration-file-model/app-version/app-version.injectable"; +import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable"; +import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable"; describe("installing update from update channels", () => { let applicationBuilder: ApplicationBuilder; @@ -73,12 +72,12 @@ describe("installing update from update channels", () => { describe("when started", () => { let rendered: RenderResult; - let checkForUpdates: () => Promise; + let processCheckingForUpdates: () => Promise; beforeEach(async () => { rendered = await applicationBuilder.render(); - checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); }); it("renders", () => { @@ -98,7 +97,7 @@ describe("installing update from update channels", () => { selectedUpdateChannel.setValue(updateChannels.alpha.id); - checkForUpdates(); + processCheckingForUpdates(); }); it('checks updates from update channel "alpha"', () => { @@ -192,7 +191,7 @@ describe("installing update from update channels", () => { describe("when checking for updates", () => { beforeEach(() => { - checkForUpdates(); + processCheckingForUpdates(); }); describe('when update from "beta" channel is discovered', () => { @@ -240,9 +239,9 @@ describe("installing update from update channels", () => { await applicationBuilder.render(); - const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object)); }); @@ -258,9 +257,9 @@ describe("installing update from update channels", () => { await applicationBuilder.render(); - const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object)); }); @@ -272,9 +271,9 @@ describe("installing update from update channels", () => { await applicationBuilder.render(); - const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith( updateChannels.latest, @@ -289,9 +288,9 @@ describe("installing update from update channels", () => { await applicationBuilder.render(); - const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.alpha, expect.any(Object)); }); @@ -303,9 +302,9 @@ describe("installing update from update channels", () => { await applicationBuilder.render(); - const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object)); }); @@ -323,9 +322,9 @@ describe("installing update from update channels", () => { await applicationBuilder.render(); - const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); - checkForUpdates(); + processCheckingForUpdates(); expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object)); }); diff --git a/src/behaviours/application-update/installing-update-using-tray.test.ts b/src/behaviours/application-update/installing-update-using-tray.test.ts index 012605d3de..83640b1a73 100644 --- a/src/behaviours/application-update/installing-update-using-tray.test.ts +++ b/src/behaviours/application-update/installing-update-using-tray.test.ts @@ -63,10 +63,10 @@ describe("installing update using tray", () => { }); describe("when user checks for updates using tray", () => { - let checkForUpdatesPromise: Promise; + let processCheckingForUpdatesPromise: Promise; beforeEach(async () => { - checkForUpdatesPromise = + processCheckingForUpdatesPromise = applicationBuilder.tray.click("check-for-updates"); }); @@ -100,7 +100,7 @@ describe("installing update using tray", () => { updateWasDiscovered: false, }); - await checkForUpdatesPromise; + await processCheckingForUpdatesPromise; }); it("shows application window", () => { @@ -135,7 +135,7 @@ describe("installing update using tray", () => { version: "some-version", }); - await checkForUpdatesPromise; + await processCheckingForUpdatesPromise; }); it("shows application window", () => { diff --git a/src/behaviours/application-update/installing-update.test.ts b/src/behaviours/application-update/installing-update.test.ts index b6b4d4c4d0..c22747819c 100644 --- a/src/behaviours/application-update/installing-update.test.ts +++ b/src/behaviours/application-update/installing-update.test.ts @@ -18,7 +18,7 @@ import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-upda import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable"; import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable"; import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable"; -import checkForUpdatesInjectable from "../../main/application-update/check-for-updates/check-for-updates.injectable"; +import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable"; describe("installing update", () => { let applicationBuilder: ApplicationBuilder; @@ -67,12 +67,12 @@ describe("installing update", () => { describe("when started", () => { let rendered: RenderResult; - let checkForUpdates: () => Promise; + let processCheckingForUpdates: () => Promise; beforeEach(async () => { rendered = await applicationBuilder.render(); - checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable); + processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); }); it("renders", () => { @@ -80,10 +80,10 @@ describe("installing update", () => { }); describe("when user checks for updates", () => { - let checkForUpdatesPromise: Promise; + let processCheckingForUpdatesPromise: Promise; beforeEach(async () => { - checkForUpdatesPromise = checkForUpdates(); + processCheckingForUpdatesPromise = processCheckingForUpdates(); }); it("checks for updates", () => { @@ -109,7 +109,7 @@ describe("installing update", () => { updateWasDiscovered: false, }); - await checkForUpdatesPromise; + await processCheckingForUpdatesPromise; }); it("notifies the user", () => { @@ -132,7 +132,7 @@ describe("installing update", () => { version: "some-version", }); - await checkForUpdatesPromise; + await processCheckingForUpdatesPromise; }); it("starts downloading the update", () => { diff --git a/src/main/application-update/check-for-updates-tray-item.injectable.ts b/src/main/application-update/check-for-updates-tray-item.injectable.ts index 5c5aea835f..8ae1d2c544 100644 --- a/src/main/application-update/check-for-updates-tray-item.injectable.ts +++ b/src/main/application-update/check-for-updates-tray-item.injectable.ts @@ -12,7 +12,7 @@ import updateIsBeingDownloadedInjectable from "../../common/application-update/u import updatesAreBeingDiscoveredInjectable from "../../common/application-update/updates-are-being-discovered/updates-are-being-discovered.injectable"; import progressOfUpdateDownloadInjectable from "../../common/application-update/progress-of-update-download/progress-of-update-download.injectable"; import assert from "assert"; -import checkForUpdatesInjectable from "./check-for-updates/check-for-updates.injectable"; +import processCheckingForUpdatesInjectable from "./check-for-updates/process-checking-for-updates.injectable"; const checkForUpdatesTrayItemInjectable = getInjectable({ id: "check-for-updates-tray-item", @@ -24,7 +24,7 @@ const checkForUpdatesTrayItemInjectable = getInjectable({ const discoveredVersionState = di.inject(discoveredUpdateVersionInjectable); const downloadingUpdateState = di.inject(updateIsBeingDownloadedInjectable); const checkingForUpdatesState = di.inject(updatesAreBeingDiscoveredInjectable); - const checkForUpdates = di.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable); return { id: "check-for-updates", @@ -52,7 +52,7 @@ const checkForUpdatesTrayItemInjectable = getInjectable({ visible: computed(() => updatingIsEnabled), click: async () => { - await checkForUpdates(); + await processCheckingForUpdates(); await showApplicationWindow(); }, diff --git a/src/main/application-update/check-for-updates/check-for-updates.injectable.ts b/src/main/application-update/check-for-updates/process-checking-for-updates.injectable.ts similarity index 96% rename from src/main/application-update/check-for-updates/check-for-updates.injectable.ts rename to src/main/application-update/check-for-updates/process-checking-for-updates.injectable.ts index d94a2af353..9a5b7e92e6 100644 --- a/src/main/application-update/check-for-updates/check-for-updates.injectable.ts +++ b/src/main/application-update/check-for-updates/process-checking-for-updates.injectable.ts @@ -14,8 +14,8 @@ import downloadUpdateInjectable from "../download-update/download-update.injecta import broadcastChangeInUpdatingStatusInjectable from "./broadcast-change-in-updating-status.injectable"; import checkForUpdatesStartingFromChannelInjectable from "./check-for-updates-starting-from-channel.injectable"; -const checkForUpdatesInjectable = getInjectable({ - id: "check-for-updates", +const processCheckingForUpdatesInjectable = getInjectable({ + id: "process-checking-for-updates", instantiate: (di) => { const askBoolean = di.inject(askBooleanInjectable); @@ -92,4 +92,4 @@ const checkForUpdatesInjectable = getInjectable({ }, }); -export default checkForUpdatesInjectable; +export default processCheckingForUpdatesInjectable; diff --git a/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts b/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts index c973330030..e1d2af1aaa 100644 --- a/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts +++ b/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts @@ -4,23 +4,23 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; -import checkForUpdatesInjectable from "../check-for-updates/check-for-updates.injectable"; +import processCheckingForUpdatesInjectable from "../check-for-updates/process-checking-for-updates.injectable"; const periodicalCheckForUpdatesInjectable = getInjectable({ id: "periodical-check-for-updates", instantiate: (di) => { - const checkForUpdates = di.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable); return getStartableStoppable("periodical-check-for-updates", () => { const TWO_HOURS = 1000 * 60 * 60 * 2; // Note: intentional orphan promise to make checking for updates happen in the background - checkForUpdates(); + processCheckingForUpdates(); const intervalId = setInterval(() => { // Note: intentional orphan promise to make checking for updates happen in the background - checkForUpdates(); + processCheckingForUpdates(); }, TWO_HOURS); return () => { diff --git a/src/main/menu/application-menu-items.injectable.ts b/src/main/menu/application-menu-items.injectable.ts index 848764d382..4ea447f675 100644 --- a/src/main/menu/application-menu-items.injectable.ts +++ b/src/main/menu/application-menu-items.injectable.ts @@ -24,7 +24,7 @@ import showAboutInjectable from "./show-about.injectable"; import applicationWindowInjectable from "../start-main-application/lens-window/application-window/application-window.injectable"; import reloadWindowInjectable from "../start-main-application/lens-window/reload-window.injectable"; import showApplicationWindowInjectable from "../start-main-application/lens-window/show-application-window.injectable"; -import checkForUpdatesInjectable from "../application-update/check-for-updates/check-for-updates.injectable"; +import processCheckingForUpdatesInjectable from "../application-update/check-for-updates/process-checking-for-updates.injectable"; function ignoreIf(check: boolean, menuItems: MenuItemOpts[]) { return check ? [] : menuItems; @@ -53,7 +53,7 @@ const applicationMenuItemsInjectable = getInjectable({ const navigateToWelcome = di.inject(navigateToWelcomeInjectable); const navigateToAddCluster = di.inject(navigateToAddClusterInjectable); const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable); - const checkForUpdates = di.inject(checkForUpdatesInjectable); + const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable); logger.info(`[MENU]: autoUpdateEnabled=${updatingIsEnabled}`); @@ -73,7 +73,7 @@ const applicationMenuItemsInjectable = getInjectable({ { label: "Check for updates", click() { - checkForUpdates().then(() => showApplicationWindow()); + processCheckingForUpdates().then(() => showApplicationWindow()); }, }, ]), @@ -285,7 +285,7 @@ const applicationMenuItemsInjectable = getInjectable({ { label: "Check for updates", click() { - checkForUpdates().then(() => + processCheckingForUpdates().then(() => showApplicationWindow(), ); },