diff --git a/src/main/__test__/cluster.test.ts b/src/main/__test__/cluster.test.ts index 980b63c767..4a9b257623 100644 --- a/src/main/__test__/cluster.test.ts +++ b/src/main/__test__/cluster.test.ts @@ -22,6 +22,10 @@ import kubectlBinaryNameInjectable from "../kubectl/binary-name.injectable"; import kubectlDownloadingNormalizedArchInjectable from "../kubectl/normalized-arch.injectable"; import { apiResourceRecord, apiResources } from "../../common/rbac"; import listApiResourcesInjectable from "../../common/cluster/list-api-resources.injectable"; +import pathExistsSyncInjectable from "../../common/fs/path-exists-sync.injectable"; +import pathExistsInjectable from "../../common/fs/path-exists.injectable"; +import readJsonSyncInjectable from "../../common/fs/read-json-sync.injectable"; +import writeJsonSyncInjectable from "../../common/fs/write-json-sync.injectable"; console = new Console(process.stdout, process.stderr); // fix mockFS @@ -56,6 +60,10 @@ describe("create clusters", () => { setupPrometheus: jest.fn(), ensureServer: jest.fn(), } as ClusterContextHandler)); + di.override(pathExistsInjectable, () => () => { throw new Error("tried call pathExists without override"); }); + di.override(pathExistsSyncInjectable, () => () => { throw new Error("tried call pathExistsSync without override"); }); + di.override(readJsonSyncInjectable, () => () => { throw new Error("tried call readJsonSync without override"); }); + di.override(writeJsonSyncInjectable, () => () => { throw new Error("tried call writeJsonSync without override"); }); createCluster = di.inject(createClusterInjectionToken); diff --git a/src/main/__test__/kube-auth-proxy.test.ts b/src/main/__test__/kube-auth-proxy.test.ts index 47064ec215..d667ad93c3 100644 --- a/src/main/__test__/kube-auth-proxy.test.ts +++ b/src/main/__test__/kube-auth-proxy.test.ts @@ -28,6 +28,10 @@ import normalizedPlatformInjectable from "../../common/vars/normalized-platform. import kubectlBinaryNameInjectable from "../kubectl/binary-name.injectable"; import kubectlDownloadingNormalizedArchInjectable from "../kubectl/normalized-arch.injectable"; import broadcastMessageInjectable from "../../common/ipc/broadcast-message.injectable"; +import pathExistsInjectable from "../../common/fs/path-exists.injectable"; +import readJsonSyncInjectable from "../../common/fs/read-json-sync.injectable"; +import writeJsonSyncInjectable from "../../common/fs/write-json-sync.injectable"; +import pathExistsSyncInjectable from "../../common/fs/path-exists-sync.injectable"; console = new Console(stdout, stderr); @@ -73,6 +77,10 @@ describe("kube auth proxy tests", () => { di.override(directoryForUserDataInjectable, () => "some-directory-for-user-data"); di.override(directoryForTempInjectable, () => "some-directory-for-temp"); + di.override(pathExistsInjectable, () => () => { throw new Error("tried call pathExists without override"); }); + di.override(pathExistsSyncInjectable, () => () => { throw new Error("tried call pathExistsSync without override"); }); + di.override(readJsonSyncInjectable, () => () => { throw new Error("tried call readJsonSync without override"); }); + di.override(writeJsonSyncInjectable, () => () => { throw new Error("tried call writeJsonSync without override"); }); spawnMock = jest.fn(); di.override(spawnInjectable, () => spawnMock); diff --git a/src/main/__test__/kubeconfig-manager.test.ts b/src/main/__test__/kubeconfig-manager.test.ts index aa0e87cfac..43c8777b2e 100644 --- a/src/main/__test__/kubeconfig-manager.test.ts +++ b/src/main/__test__/kubeconfig-manager.test.ts @@ -27,6 +27,9 @@ import type { PathExists } from "../../common/fs/path-exists.injectable"; import pathExistsInjectable from "../../common/fs/path-exists.injectable"; import type { RemovePath } from "../../common/fs/remove.injectable"; import removePathInjectable from "../../common/fs/remove.injectable"; +import pathExistsSyncInjectable from "../../common/fs/path-exists-sync.injectable"; +import readJsonSyncInjectable from "../../common/fs/read-json-sync.injectable"; +import writeJsonSyncInjectable from "../../common/fs/write-json-sync.injectable"; const clusterServerUrl = "https://192.168.64.3:8443"; @@ -50,6 +53,9 @@ describe("kubeconfig manager tests", () => { di.override(kubectlBinaryNameInjectable, () => "kubectl"); di.override(kubectlDownloadingNormalizedArchInjectable, () => "amd64"); di.override(normalizedPlatformInjectable, () => "darwin"); + di.override(pathExistsSyncInjectable, () => () => { throw new Error("tried call pathExistsSync without override"); }); + di.override(readJsonSyncInjectable, () => () => { throw new Error("tried call readJsonSync without override"); }); + di.override(writeJsonSyncInjectable, () => () => { throw new Error("tried call writeJsonSync without override"); }); readFileMock = asyncFn(); di.override(readFileInjectable, () => readFileMock); diff --git a/src/main/protocol-handler/__test__/router.test.ts b/src/main/protocol-handler/__test__/router.test.ts index 55aecaa8a0..a06c3b057b 100644 --- a/src/main/protocol-handler/__test__/router.test.ts +++ b/src/main/protocol-handler/__test__/router.test.ts @@ -19,6 +19,10 @@ import type { ObservableMap } from "mobx"; import extensionInstancesInjectable from "../../../extensions/extension-loader/extension-instances.injectable"; import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable"; import broadcastMessageInjectable from "../../../common/ipc/broadcast-message.injectable"; +import pathExistsSyncInjectable from "../../../common/fs/path-exists-sync.injectable"; +import pathExistsInjectable from "../../../common/fs/path-exists.injectable"; +import readJsonSyncInjectable from "../../../common/fs/read-json-sync.injectable"; +import writeJsonSyncInjectable from "../../../common/fs/write-json-sync.injectable"; function throwIfDefined(val: any): void { if (val != null) { @@ -35,6 +39,11 @@ describe("protocol router tests", () => { beforeEach(async () => { const di = getDiForUnitTesting({ doGeneralOverrides: true }); + di.override(pathExistsInjectable, () => () => { throw new Error("tried call pathExists without override"); }); + di.override(pathExistsSyncInjectable, () => () => { throw new Error("tried call pathExistsSync without override"); }); + di.override(readJsonSyncInjectable, () => () => { throw new Error("tried call readJsonSync without override"); }); + di.override(writeJsonSyncInjectable, () => () => { throw new Error("tried call writeJsonSync without override"); }); + enabledExtensions = new Set(); di.override(extensionsStoreInjectable, () => ({ diff --git a/src/main/shell-session/local-shell-session/techincal.test.ts b/src/main/shell-session/local-shell-session/techincal.test.ts index fbe2ccaea3..a320e6f846 100644 --- a/src/main/shell-session/local-shell-session/techincal.test.ts +++ b/src/main/shell-session/local-shell-session/techincal.test.ts @@ -7,6 +7,10 @@ import type { DiContainer } from "@ogre-tools/injectable"; import { WebSocket } from "ws"; import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable"; import type { Cluster } from "../../../common/cluster/cluster"; +import pathExistsSyncInjectable from "../../../common/fs/path-exists-sync.injectable"; +import pathExistsInjectable from "../../../common/fs/path-exists.injectable"; +import readJsonSyncInjectable from "../../../common/fs/read-json-sync.injectable"; +import writeJsonSyncInjectable from "../../../common/fs/write-json-sync.injectable"; import platformInjectable from "../../../common/vars/platform.injectable"; import { getDiForUnitTesting } from "../../getDiForUnitTesting"; import createKubectlInjectable from "../../kubectl/create-kubectl.injectable"; @@ -29,6 +33,10 @@ describe("technical unit tests for local shell sessions", () => { di.override(buildVersionInjectable, () => ({ get: () => "1.1.1", })); + di.override(pathExistsInjectable, () => () => { throw new Error("tried call pathExists without override"); }); + di.override(pathExistsSyncInjectable, () => () => { throw new Error("tried call pathExistsSync without override"); }); + di.override(readJsonSyncInjectable, () => () => { throw new Error("tried call readJsonSync without override"); }); + di.override(writeJsonSyncInjectable, () => () => { throw new Error("tried call writeJsonSync without override"); }); }); describe("when on windows", () => {