From cf0ca414ea6a9152f7ff96fae2013fa31fcd915e Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 2 Dec 2022 16:27:32 -0500 Subject: [PATCH] Fix test failures due to incomplete overrides Signed-off-by: Sebastian Malton --- .../check-for-platform-updates.test.ts | 10 ++++++++-- .../download-platform-update.test.ts | 10 ++++++++-- ...ing-active-helm-repositories-in-preferences.test.ts | 9 ++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/features/application-update/main/check-for-updates/check-for-platform-updates/check-for-platform-updates.test.ts b/src/features/application-update/main/check-for-updates/check-for-platform-updates/check-for-platform-updates.test.ts index 4d9e9d9b7b..07875dd728 100644 --- a/src/features/application-update/main/check-for-updates/check-for-platform-updates/check-for-platform-updates.test.ts +++ b/src/features/application-update/main/check-for-updates/check-for-platform-updates/check-for-platform-updates.test.ts @@ -12,7 +12,7 @@ import checkForPlatformUpdatesInjectable from "./check-for-platform-updates.inje import type { UpdateChannel, ReleaseChannel } from "../../../common/update-channels"; import { getPromiseStatus } from "../../../../../common/test-utils/get-promise-status"; import loggerInjectable from "../../../../../common/logger.injectable"; -import type { Logger } from "../../../../../common/logger"; +import { noop } from "../../../../../common/utils"; describe("check-for-platform-updates", () => { let checkForPlatformUpdates: CheckForPlatformUpdates; @@ -37,7 +37,13 @@ describe("check-for-platform-updates", () => { logErrorMock = jest.fn(); - di.override(loggerInjectable, () => ({ error: logErrorMock }) as unknown as Logger); + di.override(loggerInjectable, () => ({ + error: logErrorMock, + debug: noop, + info: noop, + silly: noop, + warn: noop, + })); checkForPlatformUpdates = di.inject(checkForPlatformUpdatesInjectable); }); diff --git a/src/features/application-update/main/download-update/download-platform-update/download-platform-update.test.ts b/src/features/application-update/main/download-update/download-platform-update/download-platform-update.test.ts index d60b4eb897..2cedacb68b 100644 --- a/src/features/application-update/main/download-update/download-platform-update/download-platform-update.test.ts +++ b/src/features/application-update/main/download-update/download-platform-update/download-platform-update.test.ts @@ -12,7 +12,7 @@ import asyncFn from "@async-fn/jest"; import { getPromiseStatus } from "../../../../../common/test-utils/get-promise-status"; import type { DiContainer } from "@ogre-tools/injectable"; import loggerInjectable from "../../../../../common/logger.injectable"; -import type { Logger } from "../../../../../common/logger"; +import { noop } from "../../../../../common/utils"; describe("download-platform-update", () => { let downloadPlatformUpdate: DownloadPlatformUpdate; @@ -43,7 +43,13 @@ describe("download-platform-update", () => { di.override(electronUpdaterInjectable, () => electronUpdaterFake); logErrorMock = jest.fn(); - di.override(loggerInjectable, () => ({ error: logErrorMock }) as unknown as Logger); + di.override(loggerInjectable, () => ({ + error: logErrorMock, + debug: noop, + info: noop, + silly: noop, + warn: noop, + })); downloadPlatformUpdate = di.inject(downloadPlatformUpdateInjectable); }); diff --git a/src/features/helm-charts/listing-active-helm-repositories-in-preferences.test.ts b/src/features/helm-charts/listing-active-helm-repositories-in-preferences.test.ts index f95387fded..49a8d0c28e 100644 --- a/src/features/helm-charts/listing-active-helm-repositories-in-preferences.test.ts +++ b/src/features/helm-charts/listing-active-helm-repositories-in-preferences.test.ts @@ -16,6 +16,7 @@ import loggerInjectable from "../../common/logger.injectable"; import type { Logger } from "../../common/logger"; import requestPublicHelmRepositoriesInjectable from "./child-features/preferences/renderer/adding-of-public-helm-repository/public-helm-repositories/request-public-helm-repositories.injectable"; import showErrorNotificationInjectable from "../../renderer/components/notifications/show-error-notification.injectable"; +import { noop } from "../../common/utils"; describe("listing active helm repositories in preferences", () => { let builder: ApplicationBuilder; @@ -32,7 +33,13 @@ describe("listing active helm repositories in preferences", () => { execFileMock = asyncFn(); showErrorNotificationMock = jest.fn(); - loggerStub = { error: jest.fn() } as unknown as Logger; + loggerStub = { + error: jest.fn(), + debug: noop, + info: noop, + silly: noop, + warn: noop, + }; builder.beforeApplicationStart((mainDi) => { mainDi.override(readYamlFileInjectable, () => readYamlFileMock);