Replace static application window with ability to create many (#5979)

* Replace static application window with ability to create as many as you wish

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Adapt tests for replacing static application window with ability to create as many as you wish and separate starting of main and window in behaviours

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make first render of application smaller in test that proves to be hard for CI

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Remove redundant code

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Simplify code

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen authored and GitHub committed 2022-08-16 15:55:42 +03:00
1 parent 299922c8a7
commit 63d5a34379
98 files changed
+3283 -2743

No files matched your search

@@ -21,7 +21,7 @@ import periodicalCheckForUpdatesInjectable from "../../main/application-update/p
import { advanceFakeTime, useFakeTime } from "../../common/test-utils/use-fake-time";
describe("analytics for installing update", () => {
let applicationBuilder: ApplicationBuilder;
let builder: ApplicationBuilder;
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
let analyticsListenerMock: jest.Mock;
@@ -30,11 +30,11 @@ describe("analytics for installing update", () => {
beforeEach(async () => {
useFakeTime("2015-10-21T07:28:00Z");
applicationBuilder = getApplicationBuilder();
builder = getApplicationBuilder();
analyticsListenerMock = jest.fn();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart(mainDi => {
mainDi.override(appVersionInjectable, () => "42.0.0");
checkForPlatformUpdatesMock = asyncFn();
@@ -56,7 +56,7 @@ describe("analytics for installing update", () => {
eventBus.addListener(analyticsListenerMock);
});
mainDi = applicationBuilder.dis.mainDi;
mainDi = builder.mainDi;
});
describe("given application is started and checking updates periodically", () => {
@@ -64,7 +64,7 @@ describe("analytics for installing update", () => {
mainDi.unoverride(periodicalCheckForUpdatesInjectable);
mainDi.permitSideEffects(periodicalCheckForUpdatesInjectable);
await applicationBuilder.render();
await builder.render();
});
@@ -101,7 +101,7 @@ describe("analytics for installing update", () => {
beforeEach(async () => {
analyticsListenerMock.mockClear();
await applicationBuilder.render();
await builder.render();
});
it("sends event to analytics about the current version", () => {
@@ -119,7 +119,7 @@ describe("analytics for installing update", () => {
it("when checking for updates using tray, sends event to analytics for being checked from tray", async () => {
analyticsListenerMock.mockClear();
applicationBuilder.tray.click("check-for-updates");
builder.tray.click("check-for-updates");
expect(analyticsListenerMock.mock.calls).toEqual([
[
@@ -140,7 +140,7 @@ describe("analytics for installing update", () => {
it("when checking for updates using application menu, sends event to analytics for being checked from application menu", async () => {
analyticsListenerMock.mockClear();
applicationBuilder.applicationMenu.click("root.check-for-updates");
builder.applicationMenu.click("root.check-for-updates");
expect(analyticsListenerMock.mock.calls).toEqual([
[
@@ -24,7 +24,7 @@ describe("downgrading version update", () => {
beforeEach(() => {
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
applicationBuilder.beforeApplicationStart(mainDi => {
checkForPlatformUpdatesMock = asyncFn();
mainDi.override(
@@ -36,7 +36,7 @@ describe("downgrading version update", () => {
mainDi.override(publishIsConfiguredInjectable, () => true);
});
mainDi = applicationBuilder.dis.mainDi;
mainDi = applicationBuilder.mainDi;
});
[
@@ -35,10 +35,7 @@ describe("force user to update when too long since update was downloaded", () =>
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi, rendererDi }) => {
rendererDi.unoverride(forceUpdateModalRootFrameComponentInjectable);
rendererDi.permitSideEffects(forceUpdateModalRootFrameComponentInjectable);
applicationBuilder.beforeApplicationStart(mainDi => {
checkForPlatformUpdatesMock = asyncFn();
mainDi.override(checkForPlatformUpdatesInjectable, () => checkForPlatformUpdatesMock);
@@ -50,13 +47,17 @@ describe("force user to update when too long since update was downloaded", () =>
quitAndInstallUpdateMock = jest.fn();
mainDi.override(quitAndInstallUpdateInjectable, () => quitAndInstallUpdateMock);
rendererDi.override(timeAfterUpdateMustBeInstalledInjectable, () => TIME_AFTER_UPDATE_MUST_BE_INSTALLED);
rendererDi.override(secondsAfterInstallStartsInjectable, () => TIME_AFTER_INSTALL_STARTS / 1000);
});
mainDi = applicationBuilder.dis.mainDi;
applicationBuilder.beforeWindowStart(windowDi => {
windowDi.unoverride(forceUpdateModalRootFrameComponentInjectable);
windowDi.permitSideEffects(forceUpdateModalRootFrameComponentInjectable);
windowDi.override(timeAfterUpdateMustBeInstalledInjectable, () => TIME_AFTER_UPDATE_MUST_BE_INSTALLED);
windowDi.override(secondsAfterInstallStartsInjectable, () => TIME_AFTER_INSTALL_STARTS / 1000);
});
mainDi = applicationBuilder.mainDi;
});
describe("when application is started", () => {
@@ -33,7 +33,7 @@ describe("encourage user to update when sufficient time passed since update was
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
applicationBuilder.beforeApplicationStart((mainDi) => {
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
@@ -76,7 +76,7 @@ describe("encourage user to update when sufficient time passed since update was
let processCheckingForUpdates: (source: string) => Promise<{ updateIsReadyToBeInstalled: boolean }>;
beforeEach(async () => {
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(
processCheckingForUpdates = applicationBuilder.mainDi.inject(
processCheckingForUpdatesInjectable,
);
@@ -105,8 +105,15 @@ describe("encourage user to update when sufficient time passed since update was
expect(button).toHaveAttribute("data-warning-level", "light");
});
// TODO: Implement after starting main and renderer is separated in ApplicationBuilder
xit("given closing the application window, when starting the application window again, still shows the button", () => {
it("given closing the application window, when starting the application window again, still shows the button", async () => {
applicationBuilder.applicationWindow.closeAll();
const window = applicationBuilder.applicationWindow.create("some-window-id");
await window.start();
const button = window.rendered.queryByTestId("update-button");
expect(button).toBeInTheDocument();
});
@@ -13,19 +13,18 @@ import type { AsyncFnMock } from "@async-fn/jest";
import asyncFn from "@async-fn/jest";
import type { DownloadPlatformUpdate } from "../../main/application-update/download-platform-update/download-platform-update.injectable";
import downloadPlatformUpdateInjectable from "../../main/application-update/download-platform-update/download-platform-update.injectable";
import closeAllWindowsInjectable from "../../main/start-main-application/lens-window/hide-all-windows/close-all-windows.injectable";
import applicationWindowInjectable from "../../main/start-main-application/lens-window/application-window/application-window.injectable";
import type { LensWindow } from "../../main/start-main-application/lens-window/application-window/lens-window-injection-token";
import type { LensWindow } from "../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
import getCurrentApplicationWindowInjectable from "../../main/start-main-application/lens-window/application-window/get-current-application-window.injectable";
describe("installing update using tray", () => {
let applicationBuilder: ApplicationBuilder;
let builder: ApplicationBuilder;
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
beforeEach(() => {
applicationBuilder = getApplicationBuilder();
builder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
@@ -48,7 +47,7 @@ describe("installing update using tray", () => {
let rendered: RenderResult;
beforeEach(async () => {
rendered = await applicationBuilder.render();
rendered = await builder.render();
});
it("renders", () => {
@@ -56,23 +55,20 @@ describe("installing update using tray", () => {
});
it("user cannot install update yet", () => {
expect(applicationBuilder.tray.get("install-update")).toBeNull();
expect(builder.tray.get("install-update")).toBeNull();
});
describe("given all application windows are closed, when checking for updates", () => {
let applicationWindow: LensWindow;
let closeAllWindows: () => void;
let getCurrentApplicationWindow: () => LensWindow | undefined;
beforeEach(() => {
const mainDi = applicationBuilder.dis.mainDi;
getCurrentApplicationWindow = builder.mainDi.inject(
getCurrentApplicationWindowInjectable,
);
closeAllWindows = mainDi.inject(closeAllWindowsInjectable);
builder.applicationWindow.closeAll();
applicationWindow = mainDi.inject(applicationWindowInjectable);
closeAllWindows();
applicationBuilder.tray.click("check-for-updates");
builder.tray.click("check-for-updates");
});
describe("when check for update resolves with new update", () => {
@@ -84,37 +80,44 @@ describe("installing update using tray", () => {
});
it("does not show application window yet", () => {
expect(applicationWindow.isVisible).toBe(false);
const actual = getCurrentApplicationWindow();
expect(actual).toBeUndefined();
});
describe("when download of update resolves with success", () => {
beforeEach(async () => {
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: true });
});
it("shows the application window", () => {
expect(applicationWindow.isVisible).toBe(true);
const actual = getCurrentApplicationWindow();
expect(actual).not.toBeUndefined();
});
it("given closing application window again and checking for updates again using tray, when check resolves with same version that was earlier downloaded, shows the application window", async () => {
closeAllWindows();
builder.applicationWindow.closeAll();
applicationBuilder.tray.click("check-for-updates");
builder.tray.click("check-for-updates");
await checkForPlatformUpdatesMock.resolve({
updateWasDiscovered: true,
version: "some-version",
});
expect(applicationWindow.isVisible).toBe(true);
const actual = getCurrentApplicationWindow();
expect(actual).not.toBeUndefined();
});
});
it("when download of update resolves with failure, does not show the application window", async () => {
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: false });
expect(applicationWindow.isVisible).toBe(false);
const actual = getCurrentApplicationWindow();
expect(actual).toBeUndefined();
});
});
@@ -123,29 +126,31 @@ describe("installing update using tray", () => {
updateWasDiscovered: false,
});
expect(applicationWindow.isVisible).toBe(false);
const actual = getCurrentApplicationWindow();
expect(actual).toBeUndefined();
});
});
describe("when user checks for updates using tray", () => {
beforeEach(() => {
applicationBuilder.tray.click("check-for-updates");
builder.tray.click("check-for-updates");
});
it("user cannot check for updates again", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.enabled,
builder.tray.get("check-for-updates")?.enabled,
).toBe(false);
});
it("name of tray item for checking updates indicates that checking is happening", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.label,
builder.tray.get("check-for-updates")?.label,
).toBe("Checking for updates...");
});
it("user cannot install update yet", () => {
expect(applicationBuilder.tray.get("install-update")).toBeNull();
expect(builder.tray.get("install-update")).toBeNull();
});
it("renders", () => {
@@ -160,18 +165,18 @@ describe("installing update using tray", () => {
});
it("user cannot install update", () => {
expect(applicationBuilder.tray.get("install-update")).toBeNull();
expect(builder.tray.get("install-update")).toBeNull();
});
it("user can check for updates again", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.enabled,
builder.tray.get("check-for-updates")?.enabled,
).toBe(true);
});
it("name of tray item for checking updates no longer indicates that checking is happening", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.label,
builder.tray.get("check-for-updates")?.label,
).toBe("Check for updates");
});
@@ -190,13 +195,13 @@ describe("installing update using tray", () => {
it("user cannot check for updates again yet", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.enabled,
builder.tray.get("check-for-updates")?.enabled,
).toBe(false);
});
it("name of tray item for checking updates indicates that downloading is happening", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.label,
builder.tray.get("check-for-updates")?.label,
).toBe("Downloading update some-version (0%)...");
});
@@ -204,12 +209,12 @@ describe("installing update using tray", () => {
downloadPlatformUpdateMock.mock.calls[0][0]({ percentage: 42.424242 });
expect(
applicationBuilder.tray.get("check-for-updates")?.label,
builder.tray.get("check-for-updates")?.label,
).toBe("Downloading update some-version (42%)...");
});
it("user still cannot install update", () => {
expect(applicationBuilder.tray.get("install-update")).toBeNull();
expect(builder.tray.get("install-update")).toBeNull();
});
it("renders", () => {
@@ -223,19 +228,19 @@ describe("installing update using tray", () => {
it("user cannot install update", () => {
expect(
applicationBuilder.tray.get("install-update"),
builder.tray.get("install-update"),
).toBeNull();
});
it("user can check for updates again", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.enabled,
builder.tray.get("check-for-updates")?.enabled,
).toBe(true);
});
it("name of tray item for checking updates no longer indicates that downloading is happening", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.label,
builder.tray.get("check-for-updates")?.label,
).toBe("Check for updates");
});
@@ -251,19 +256,19 @@ describe("installing update using tray", () => {
it("user can install update", () => {
expect(
applicationBuilder.tray.get("install-update")?.label,
builder.tray.get("install-update")?.label,
).toBe("Install update some-version");
});
it("user can check for updates again", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.enabled,
builder.tray.get("check-for-updates")?.enabled,
).toBe(true);
});
it("name of tray item for checking updates no longer indicates that downloading is happening", () => {
expect(
applicationBuilder.tray.get("check-for-updates")?.label,
builder.tray.get("check-for-updates")?.label,
).toBe("Check for updates");
});
@@ -20,7 +20,7 @@ import { useFakeTime } from "../../common/test-utils/use-fake-time";
import staticFilesDirectoryInjectable from "../../common/vars/static-files-directory.injectable";
describe("installing update", () => {
let applicationBuilder: ApplicationBuilder;
let builder: ApplicationBuilder;
let quitAndInstallUpdateMock: jest.Mock;
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
@@ -29,9 +29,9 @@ describe("installing update", () => {
beforeEach(() => {
useFakeTime("2015-10-21T07:28:00Z");
applicationBuilder = getApplicationBuilder();
builder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
quitAndInstallUpdateMock = jest.fn();
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
@@ -66,9 +66,9 @@ describe("installing update", () => {
let processCheckingForUpdates: (source: string) => Promise<{ updateIsReadyToBeInstalled: boolean }>;
beforeEach(async () => {
rendered = await applicationBuilder.render();
rendered = await builder.render();
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(
processCheckingForUpdates = builder.mainDi.inject(
processCheckingForUpdatesInjectable,
);
});
@@ -78,7 +78,7 @@ describe("installing update", () => {
});
it("shows normal tray icon", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconTemplate.png",
);
});
@@ -96,7 +96,7 @@ describe("installing update", () => {
});
it("shows tray icon for checking for updates", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconCheckingForUpdatesTemplate.png",
);
});
@@ -113,7 +113,7 @@ describe("installing update", () => {
});
it("shows tray icon for normal", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconTemplate.png",
);
});
@@ -140,7 +140,7 @@ describe("installing update", () => {
});
it("still shows tray icon for downloading", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconCheckingForUpdatesTemplate.png",
);
});
@@ -159,7 +159,7 @@ describe("installing update", () => {
});
it("still shows normal tray icon", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconTemplate.png",
);
});
@@ -179,7 +179,7 @@ describe("installing update", () => {
});
it("shows tray icon for update being available", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconUpdateAvailableTemplate.png",
);
});
@@ -196,7 +196,7 @@ describe("installing update", () => {
});
it("shows tray icon for checking for updates", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconCheckingForUpdatesTemplate.png",
);
});
@@ -214,7 +214,7 @@ describe("installing update", () => {
});
it("shows tray icon for update being available", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconUpdateAvailableTemplate.png",
);
});
@@ -233,7 +233,7 @@ describe("installing update", () => {
});
it("shows tray icon for downloading update", () => {
expect(applicationBuilder.tray.getIconPath()).toBe(
expect(builder.tray.getIconPath()).toBe(
"/some-static-files-directory/icons/trayIconCheckingForUpdatesTemplate.png",
);
});
@@ -14,15 +14,15 @@ import { advanceFakeTime, useFakeTime } from "../../common/test-utils/use-fake-t
const ENOUGH_TIME = 1000 * 60 * 60 * 2;
describe("periodical checking of updates", () => {
let applicationBuilder: ApplicationBuilder;
let builder: ApplicationBuilder;
let processCheckingForUpdatesMock: jest.Mock;
beforeEach(() => {
useFakeTime("2015-10-21T07:28:00Z");
applicationBuilder = getApplicationBuilder();
builder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.unoverride(periodicalCheckForUpdatesInjectable);
mainDi.permitSideEffects(periodicalCheckForUpdatesInjectable);
@@ -39,12 +39,12 @@ describe("periodical checking of updates", () => {
let rendered: RenderResult;
beforeEach(async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
mainDi.override(publishIsConfiguredInjectable, () => true);
});
rendered = await applicationBuilder.render();
rendered = await builder.render();
});
it("renders", () => {
@@ -74,12 +74,12 @@ describe("periodical checking of updates", () => {
describe("given updater is enabled but no configuration exist, when started", () => {
beforeEach(async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
mainDi.override(publishIsConfiguredInjectable, () => false);
});
await applicationBuilder.render();
await builder.render();
});
it("does not check for updates", () => {
@@ -95,12 +95,12 @@ describe("periodical checking of updates", () => {
describe("given updater is not enabled but and configuration exist, when started", () => {
beforeEach(async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(electronUpdaterIsActiveInjectable, () => false);
mainDi.override(publishIsConfiguredInjectable, () => true);
});
await applicationBuilder.render();
await builder.render();
});
it("does not check for updates", () => {
@@ -22,26 +22,25 @@ import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-upda
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
import appVersionInjectable from "../../common/vars/app-version.injectable";
import type { DiContainer } from "@ogre-tools/injectable";
describe("selection of update stability", () => {
let applicationBuilder: ApplicationBuilder;
let builder: ApplicationBuilder;
let quitAndInstallUpdateMock: jest.Mock;
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
let setUpdateOnQuitMock: jest.Mock;
let showInfoNotificationMock: jest.Mock;
let mainDi: DiContainer;
beforeEach(() => {
applicationBuilder = getApplicationBuilder();
builder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi, rendererDi }) => {
builder.beforeApplicationStart((mainDi) => {
quitAndInstallUpdateMock = jest.fn();
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
setUpdateOnQuitMock = jest.fn();
showInfoNotificationMock = jest.fn(() => () => {});
rendererDi.override(showInfoNotificationInjectable, () => showInfoNotificationMock);
mainDi.override(setUpdateOnQuitInjectable, () => setUpdateOnQuitMock);
@@ -63,6 +62,14 @@ describe("selection of update stability", () => {
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
mainDi.override(publishIsConfiguredInjectable, () => true);
});
builder.beforeWindowStart((windowDi) => {
showInfoNotificationMock = jest.fn(() => () => {});
windowDi.override(showInfoNotificationInjectable, () => showInfoNotificationMock);
});
mainDi = builder.mainDi;
});
describe("when started", () => {
@@ -70,9 +77,9 @@ describe("selection of update stability", () => {
let processCheckingForUpdates: (source: string) => Promise<{ updateIsReadyToBeInstalled: boolean }>;
beforeEach(async () => {
rendered = await applicationBuilder.render();
rendered = await builder.render();
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
});
it("renders", () => {
@@ -86,7 +93,7 @@ describe("selection of update stability", () => {
};
beforeEach(() => {
selectedUpdateChannel = applicationBuilder.dis.mainDi.inject(
selectedUpdateChannel = mainDi.inject(
selectedUpdateChannelInjectable,
);
@@ -177,7 +184,7 @@ describe("selection of update stability", () => {
};
beforeEach(() => {
selectedUpdateChannel = applicationBuilder.dis.mainDi.inject(
selectedUpdateChannel = mainDi.inject(
selectedUpdateChannelInjectable,
);
@@ -224,7 +231,7 @@ describe("selection of update stability", () => {
});
it("given valid update channel selection is stored, when checking for updates, checks for updates from the update channel", async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
// TODO: Switch to more natural way of setting initial value
// TODO: UserStore is currently responsible for getting and setting initial value
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
@@ -232,9 +239,9 @@ describe("selection of update stability", () => {
selectedUpdateChannel.setValue(updateChannels.beta.id);
});
await applicationBuilder.render();
await builder.render();
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates("irrelevant");
@@ -242,7 +249,7 @@ describe("selection of update stability", () => {
});
it("given invalid update channel selection is stored, when checking for updates, checks for updates from the update channel", async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
// TODO: Switch to more natural way of setting initial value
// TODO: UserStore is currently responsible for getting and setting initial value
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
@@ -250,9 +257,9 @@ describe("selection of update stability", () => {
selectedUpdateChannel.setValue("something-invalid" as UpdateChannelId);
});
await applicationBuilder.render();
await builder.render();
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates("irrelevant");
@@ -260,13 +267,13 @@ describe("selection of update stability", () => {
});
it('given no update channel selection is stored and currently using stable release, when user checks for updates, checks for updates from "latest" update channel by default', async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(appVersionInjectable, () => "1.0.0");
});
await applicationBuilder.render();
await builder.render();
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates("irrelevant");
@@ -277,13 +284,13 @@ describe("selection of update stability", () => {
});
it('given no update channel selection is stored and currently using alpha release, when checking for updates, checks for updates from "alpha" channel', async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
});
await applicationBuilder.render();
await builder.render();
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates("irrelevant");
@@ -291,13 +298,13 @@ describe("selection of update stability", () => {
});
it('given no update channel selection is stored and currently using beta release, when checking for updates, checks for updates from "beta" channel', async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(appVersionInjectable, () => "1.0.0-beta");
});
await applicationBuilder.render();
await builder.render();
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates("irrelevant");
@@ -305,7 +312,7 @@ describe("selection of update stability", () => {
});
it("given update channel selection is stored and currently using prerelease, when checking for updates, checks for updates from stored channel", async () => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
builder.beforeApplicationStart((mainDi) => {
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
// TODO: Switch to more natural way of setting initial value
@@ -315,9 +322,9 @@ describe("selection of update stability", () => {
selectedUpdateChannel.setValue(updateChannels.beta.id);
});
await applicationBuilder.render();
await builder.render();
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
processCheckingForUpdates("irrelevant");