Skip to content

Commit

Permalink
Adapt changes in master back to state where release branch is
Browse files Browse the repository at this point in the history
Signed-off-by: Janne Savolainen <[email protected]>
  • Loading branch information
jansav committed Apr 6, 2023
1 parent aab8255 commit 0091a41
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 85 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getGlobalOverride } from "@k8slens/test-utils";
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
import requestSystemCAsInjectable from "./request-system-cas.injectable";

export default getGlobalOverride(requestSystemCAsInjectable, () => async () => []);
6 changes: 0 additions & 6 deletions packages/core/src/main/getDi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { createContainer } from "@ogre-tools/injectable";
import { runInAction } from "mobx";
import applicationInformationInjectable from "../common/vars/application-information-injectable";

export const getDi = () => {
const di = createContainer("main");

runInAction(() => {
di.register(applicationInformationInjectable);
});

return di;
};
11 changes: 1 addition & 10 deletions packages/core/src/main/getDiForUnitTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { chunk } from "lodash/fp";
import type { DiContainer, Injectable } from "@ogre-tools/injectable";
import { createContainer, isInjectable, getInjectable } from "@ogre-tools/injectable";
import { createContainer, isInjectable } from "@ogre-tools/injectable";
import { Environments, setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
import spawnInjectable from "./child-process/spawn.injectable";
import initializeExtensionsInjectable from "./start-main-application/runnables/initialize-extensions.injectable";
Expand All @@ -28,8 +28,6 @@ import waitUntilBundledExtensionsAreLoadedInjectable from "./start-main-applicat
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
import initializeClusterManagerInjectable from "./cluster/initialize-manager.injectable";
import type { GlobalOverride } from "../common/test-utils/get-global-override";
import applicationInformationInjectable from "../common/vars/application-information-injectable";
import nodeEnvInjectionToken from "../common/vars/node-env-injection-token";
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";

export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) {
Expand All @@ -39,12 +37,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {})

const di = createContainer("main");

di.register(getInjectable({
id: "node-env",
instantiate: () => "production",
injectionToken: nodeEnvInjectionToken,
}));

setLegacyGlobalDiForExtensionApi(di, Environments.main);

di.preventSideEffects();
Expand All @@ -58,7 +50,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {})

runInAction(() => {
registerMobX(di);
di.register(applicationInformationInjectable);

chunk(100)(injectables).forEach(chunkInjectables => {
di.register(...chunkInjectables);
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/renderer/getDi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
*/

import { createContainer } from "@ogre-tools/injectable";
import { runInAction } from "mobx";
import applicationInformationInjectable from "../common/vars/application-information-injectable";

export const getDi = () => {
const di = createContainer("renderer");

runInAction(() => {
di.register(applicationInformationInjectable);
});

return di;
};
11 changes: 1 addition & 10 deletions packages/core/src/renderer/getDiForUnitTesting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { noop, chunk } from "lodash/fp";
import type { Injectable } from "@ogre-tools/injectable";
import { createContainer, isInjectable, getInjectable } from "@ogre-tools/injectable";
import { createContainer, isInjectable } from "@ogre-tools/injectable";
import { Environments, setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
import requestFromChannelInjectable from "./utils/channel/request-from-channel.injectable";
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";
Expand All @@ -18,8 +18,6 @@ import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
import watchHistoryStateInjectable from "./remote-helpers/watch-history-state.injectable";
import legacyOnChannelListenInjectable from "./ipc/legacy-channel-listen.injectable";
import type { GlobalOverride } from "../common/test-utils/get-global-override";
import applicationInformationInjectable from "../common/vars/application-information-injectable";
import nodeEnvInjectionToken from "../common/vars/node-env-injection-token";

export const getDiForUnitTesting = (
opts: { doGeneralOverrides?: boolean } = {},
Expand All @@ -28,12 +26,6 @@ export const getDiForUnitTesting = (

const di = createContainer("renderer");

di.register(getInjectable({
id: "node-env",
instantiate: () => "production",
injectionToken: nodeEnvInjectionToken,
}));

di.preventSideEffects();

setLegacyGlobalDiForExtensionApi(di, Environments.renderer);
Expand All @@ -47,7 +39,6 @@ export const getDiForUnitTesting = (

runInAction(() => {
registerMobX(di);
di.register(applicationInformationInjectable);

chunk(100)(injectables).forEach((chunkInjectables) => {
di.register(...chunkInjectables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { getInjectable } from "@ogre-tools/injectable";
import { applicationInformationToken } from "@k8slens/application";
import { applicationInformationToken } from "../common/vars/application-information-token";

export const applicationInformationFakeInjectable = getInjectable({
id: "application-information-fake",
Expand All @@ -14,15 +14,19 @@ export const applicationInformationFakeInjectable = getInjectable({
productName: "some-product-name",
version: "6.0.0",
updatingIsEnabled: false,
k8sProxyVersion: "0.2.1",
bundledKubectlVersion: "1.23.3",
bundledHelmVersion: "3.7.2",
sentryDsn: "",
contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:",
welcomeRoute: "/welcome",
copyright: "some-copyright-information",
description: "some-descriptive-text",
dependencies: {},
build: {},

config: {
welcomeRoute: "/welcome",
bundledKubectlVersion: "1.23.3",
bundledHelmVersion: "3.7.2",
k8sProxyVersion: "0.2.1",
sentryDsn: "",
contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:",
}
}),

injectionToken: applicationInformationToken,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/test-env/node-env.injectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { nodeEnvInjectionToken } from "../main/library";
import nodeEnvInjectionToken from "../common/vars/node-env-injection-token";

const nodeEnvForTestingEnvInjectable = getInjectable({
id: "node-env-for-testing-env",
Expand Down

0 comments on commit 0091a41

Please sign in to comment.