From 323b91e004b6ad9880c78b06139a720165f466b4 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 6 Jul 2022 15:55:06 -0400 Subject: [PATCH] Fix tests Signed-off-by: Sebastian Malton --- src/main/getDiForUnitTesting.ts | 6 +++++- .../cluster-frame/__snapshots__/cluster-frame.test.tsx.snap | 3 +++ src/renderer/getDiForUnitTesting.tsx | 6 ++++++ .../shell-sessions/__snapshots__/local.test.ts.snap | 6 +++--- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/getDiForUnitTesting.ts b/src/main/getDiForUnitTesting.ts index b677455713..86e3df7df3 100644 --- a/src/main/getDiForUnitTesting.ts +++ b/src/main/getDiForUnitTesting.ts @@ -104,6 +104,8 @@ import focusApplicationInjectable from "./electron-app/features/focus-applicatio import getValidCwdInjectable from "./shell-session/get-valid-cwd.injectable"; import getCachedShellEnvInjectable from "./shell-session/get-cached-shell-env.injectable"; import spawnPtyInjectable from "./shell-session/spawn-pty.injectable"; +import isProductionInjectable from "../common/vars/is-production.injectable"; +import isTestEnvInjectable from "../common/vars/is-test-env.injectable"; export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) { const { @@ -127,6 +129,9 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) di.preventSideEffects(); if (doGeneralOverrides) { + di.override(isProductionInjectable, () => false); + di.override(isDevelopmentInjectable, () => false); + di.override(isTestEnvInjectable, () => true); di.override(electronInjectable, () => ({})); di.override(waitUntilBundledExtensionsAreLoadedInjectable, () => async () => {}); di.override(getRandomIdInjectable, () => () => "some-irrelevant-random-id"); @@ -146,7 +151,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) overrideRunnablesHavingSideEffects(di); overrideElectronFeatures(di); - di.override(isDevelopmentInjectable, () => false); di.override(environmentVariablesInjectable, () => ({})); di.override(commandLineArgumentsInjectable, () => []); diff --git a/src/renderer/frames/cluster-frame/__snapshots__/cluster-frame.test.tsx.snap b/src/renderer/frames/cluster-frame/__snapshots__/cluster-frame.test.tsx.snap index 6b59eeb03e..55c03d9fb2 100644 --- a/src/renderer/frames/cluster-frame/__snapshots__/cluster-frame.test.tsx.snap +++ b/src/renderer/frames/cluster-frame/__snapshots__/cluster-frame.test.tsx.snap @@ -372,6 +372,7 @@ exports[` given cluster with list nodes and namespaces permissio >