mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify even more naming
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
1 parent
9c5971378b
commit
3e5f374122
9 files changed
+61
-63
No files matched your search
@@ -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<void>>;
|
||||
let processCheckingForUpdatesMock: AsyncFnMock<() => Promise<void>>;
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
@@ -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<void>;
|
||||
let processCheckingForUpdates: () => Promise<void>;
|
||||
|
||||
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));
|
||||
});
|
||||
|
||||
@@ -63,10 +63,10 @@ describe("installing update using tray", () => {
|
||||
});
|
||||
|
||||
describe("when user checks for updates using tray", () => {
|
||||
let checkForUpdatesPromise: Promise<void>;
|
||||
let processCheckingForUpdatesPromise: Promise<void>;
|
||||
|
||||
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", () => {
|
||||
|
||||
@@ -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<void>;
|
||||
let processCheckingForUpdates: () => Promise<void>;
|
||||
|
||||
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<void>;
|
||||
let processCheckingForUpdatesPromise: Promise<void>;
|
||||
|
||||
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", () => {
|
||||
|
||||
Reference in new issue
Block a user