override logger with mocks only when needed for tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-05-05 09:01:57 -04:00
1 parent f2a0b72253
commit 9d4b6c52c0
4 files changed
+31 -12

No files matched your search

+6 -5
View File
@@ -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,
}));
}