diff --git a/packages/core/src/jest.setup.ts b/packages/core/src/jest.setup.ts index bfc5d42cb7..96a4b816d4 100644 --- a/packages/core/src/jest.setup.ts +++ b/packages/core/src/jest.setup.ts @@ -58,7 +58,7 @@ jest.mock("./renderer/components/tooltip/withTooltip"); jest.mock("monaco-editor"); const getInjectables = (environment: "renderer" | "main", filePathGlob: string) => [ - ...glob.sync(`./{common,extensions,${environment}}/**/${filePathGlob}`, { + ...glob.sync(`./{common,extensions,${environment},test-env}/**/${filePathGlob}`, { cwd: __dirname, }), diff --git a/packages/core/src/test-env/application-information-fake.injectable.ts b/packages/core/src/test-env/application-information-fake.injectable.ts new file mode 100644 index 0000000000..c5d9bfa8d2 --- /dev/null +++ b/packages/core/src/test-env/application-information-fake.injectable.ts @@ -0,0 +1,29 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +import { getInjectable } from "@ogre-tools/injectable"; +import { applicationInformationToken } from "@k8slens/application"; + +export const applicationInformationFakeInjectable = getInjectable({ + id: "application-information-fake", + + instantiate: () => ({ + name: "some-product-name", + 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: {}, + }), + + injectionToken: applicationInformationToken, +}); diff --git a/packages/core/src/test-env/node-env.injectable.ts b/packages/core/src/test-env/node-env.injectable.ts new file mode 100644 index 0000000000..b08639d94c --- /dev/null +++ b/packages/core/src/test-env/node-env.injectable.ts @@ -0,0 +1,14 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import { getInjectable } from "@ogre-tools/injectable"; +import { nodeEnvInjectionToken } from "../main/library"; + +const nodeEnvForTestingEnvInjectable = getInjectable({ + id: "node-env-for-testing-env", + instantiate: () => "production", + injectionToken: nodeEnvInjectionToken, +}); + +export default nodeEnvForTestingEnvInjectable;