diff --git a/src/common/__tests__/hotbar-store.test.ts b/src/common/__tests__/hotbar-store.test.ts index 687ab1d292..45c7d63e66 100644 --- a/src/common/__tests__/hotbar-store.test.ts +++ b/src/common/__tests__/hotbar-store.test.ts @@ -89,7 +89,15 @@ describe("HotbarStore", () => { di.override(hasCategoryForEntityInjectable, () => () => true); - logger = di.inject(loggerInjectable) as jest.Mocked; + logger = { + warn: jest.fn(), + debug: jest.fn(), + error: jest.fn(), + info: jest.fn(), + silly: jest.fn(), + }; + + di.override(loggerInjectable, () => logger); const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable); const catalogCatalogEntity = di.inject(catalogCatalogEntityInjectable); diff --git a/src/main/__test__/kubeconfig-manager.test.ts b/src/main/__test__/kubeconfig-manager.test.ts index deee67f050..f21fa70e06 100644 --- a/src/main/__test__/kubeconfig-manager.test.ts +++ b/src/main/__test__/kubeconfig-manager.test.ts @@ -33,7 +33,16 @@ describe("kubeconfig manager tests", () => { di = getDiForUnitTesting({ doGeneralOverrides: true }); di.override(directoryForTempInjectable, () => "some-directory-for-temp"); - logger = di.inject(loggerInjectable) as jest.Mocked; + + logger = { + warn: jest.fn(), + debug: jest.fn(), + error: jest.fn(), + info: jest.fn(), + silly: jest.fn(), + }; + + di.override(loggerInjectable, () => logger); mockFs({ "minikube-config.yml": JSON.stringify({ diff --git a/src/main/getDiForUnitTesting.ts b/src/main/getDiForUnitTesting.ts index a355c7698c..acb90788bc 100644 --- a/src/main/getDiForUnitTesting.ts +++ b/src/main/getDiForUnitTesting.ts @@ -35,6 +35,7 @@ import joinPathsInjectable from "../common/path/join-paths.injectable"; import { joinPathsFake } from "../common/test-utils/join-paths-fake"; import hotbarStoreInjectable from "../common/hotbars/store.injectable"; import type { GetDiForUnitTestingOptions } from "../test-utils/get-dis-for-unit-testing"; +import { noop } from "../renderer/utils"; export interface GetMainDiForUnitTestingOptions extends GetDiForUnitTestingOptions { overrideHotbarStore?: boolean; @@ -130,11 +131,11 @@ export function getDiForUnitTesting(opts: GetMainDiForUnitTestingOptions = {}) { }); di.override(loggerInjectable, () => ({ - warn: jest.fn(), - debug: jest.fn(), - error: jest.fn(), - info: jest.fn(), - silly: jest.fn(), + warn: noop, + debug: noop, + error: noop, + info: noop, + silly: noop, })); } diff --git a/src/renderer/getDiForUnitTesting.tsx b/src/renderer/getDiForUnitTesting.tsx index e994304bfe..353eedf0ee 100644 --- a/src/renderer/getDiForUnitTesting.tsx +++ b/src/renderer/getDiForUnitTesting.tsx @@ -34,6 +34,7 @@ import terminalSpawningPoolInjectable from "./components/dock/terminal/terminal- import hostedClusterIdInjectable from "../common/cluster-store/hosted-cluster-id.injectable"; import type { GetDiForUnitTestingOptions } from "../test-utils/get-dis-for-unit-testing"; import historyInjectable from "./navigation/history.injectable"; +import { noop } from "./utils"; export const getDiForUnitTesting = (opts: GetDiForUnitTestingOptions = {}) => { const { @@ -86,11 +87,11 @@ export const getDiForUnitTesting = (opts: GetDiForUnitTestingOptions = {}) => { di.override(focusWindowInjectable, () => () => {}); di.override(loggerInjectable, () => ({ - warn: jest.fn(), - debug: jest.fn(), - error: jest.fn(), - info: jest.fn(), - silly: jest.fn(), + warn: noop, + debug: noop, + error: noop, + info: noop, + silly: noop, })); }