Mark injectable causing side effects

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen committed 2022-05-25 10:08:50 +03:00
1 parent 0f43ca0ce6
commit 241dea63c9
3 files changed
+8 -4

No files matched your search

@@ -10,7 +10,7 @@ import publishIsConfiguredInjectable from "../../main/application-update/publish
import type { AsyncFnMock } from "@async-fn/jest";
import asyncFn from "@async-fn/jest";
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";
import periodicalCheckForUpdatesInjectable from "../../main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable";
const ENOUGH_TIME = 1000 * 60 * 60 * 2;
@@ -24,7 +24,8 @@ describe("periodical checking of updates", () => {
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
mainDi.unoverride(startCheckingForUpdatesInjectable);
mainDi.unoverride(periodicalCheckForUpdatesInjectable);
mainDi.permitSideEffects(periodicalCheckForUpdatesInjectable);
processCheckingForUpdatesMock = asyncFn();
@@ -28,6 +28,8 @@ const periodicalCheckForUpdatesInjectable = getInjectable({
};
});
},
causesSideEffects: true,
});
export default periodicalCheckForUpdatesInjectable;
+3 -2
View File
@@ -84,9 +84,10 @@ import setUpdateOnQuitInjectable from "./electron-app/features/set-update-on-qui
import downloadPlatformUpdateInjectable from "./application-update/download-platform-update/download-platform-update.injectable";
import startCatalogSyncInjectable from "./catalog-sync-to-renderer/start-catalog-sync.injectable";
import startKubeConfigSyncInjectable from "./start-main-application/runnables/kube-config-sync/start-kube-config-sync.injectable";
import startCheckingForUpdatesInjectable from "./application-update/periodical-check-for-updates/start-checking-for-updates.injectable";
import appVersionInjectable from "../common/get-configuration-file-model/app-version/app-version.injectable";
import getRandomIdInjectable from "../common/utils/get-random-id.injectable";
import periodicalCheckForUpdatesInjectable
from "./application-update/periodical-check-for-updates/periodical-check-for-updates.injectable";
export function getDiForUnitTesting(opts: GetDiForUnitTestingOptions = {}) {
const {
@@ -135,7 +136,7 @@ export function getDiForUnitTesting(opts: GetDiForUnitTestingOptions = {}) {
di.override(applicationMenuInjectable, () => ({ start: () => {}, stop: () => {} }));
di.override(startCheckingForUpdatesInjectable, () => ({ run: () => {} }));
di.override(periodicalCheckForUpdatesInjectable, () => ({ start: () => {}, stop: () => {}, started: false }));
// TODO: Remove usages of globally exported appEventBus to get rid of this
di.override(appEventBusInjectable, () => new EventEmitter<[AppEvent]>());