mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix app paths tests by making the tests run in "production" mode
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
93d5f73089
commit
120e8ba0c1
@ -19,23 +19,23 @@ describe("app-paths", () => {
|
||||
builder = getApplicationBuilder();
|
||||
|
||||
const defaultAppPathsStub: AppPaths = {
|
||||
currentApp: "some-current-app",
|
||||
appData: "some-app-data",
|
||||
cache: "some-cache",
|
||||
crashDumps: "some-crash-dumps",
|
||||
desktop: "some-desktop",
|
||||
documents: "some-documents",
|
||||
downloads: "some-downloads",
|
||||
exe: "some-exe",
|
||||
home: "some-home-path",
|
||||
logs: "some-logs",
|
||||
module: "some-module",
|
||||
music: "some-music",
|
||||
pictures: "some-pictures",
|
||||
recent: "some-recent",
|
||||
temp: "some-temp",
|
||||
videos: "some-videos",
|
||||
userData: "some-irrelevant-user-data",
|
||||
currentApp: "/some-current-app",
|
||||
appData: "/some-app-data",
|
||||
cache: "/some-cache",
|
||||
crashDumps: "/some-crash-dumps",
|
||||
desktop: "/some-desktop",
|
||||
documents: "/some-documents",
|
||||
downloads: "/some-downloads",
|
||||
exe: "/some-exe",
|
||||
home: "/some-home-path",
|
||||
logs: "/some-logs",
|
||||
module: "/some-module",
|
||||
music: "/some-music",
|
||||
pictures: "/some-pictures",
|
||||
recent: "/some-recent",
|
||||
temp: "/some-temp",
|
||||
videos: "/some-videos",
|
||||
userData: "/some-irrelevant-user-data",
|
||||
};
|
||||
|
||||
builder.beforeApplicationStart((mainDi) => {
|
||||
@ -71,23 +71,23 @@ describe("app-paths", () => {
|
||||
const actual = windowDi.inject(appPathsInjectable);
|
||||
|
||||
expect(actual).toEqual({
|
||||
currentApp: "some-current-app",
|
||||
appData: "some-app-data",
|
||||
cache: "some-cache",
|
||||
crashDumps: "some-crash-dumps",
|
||||
desktop: "some-desktop",
|
||||
documents: "some-documents",
|
||||
downloads: "some-downloads",
|
||||
exe: "some-exe",
|
||||
home: "some-home-path",
|
||||
logs: "some-logs",
|
||||
module: "some-module",
|
||||
music: "some-music",
|
||||
pictures: "some-pictures",
|
||||
recent: "some-recent",
|
||||
temp: "some-temp",
|
||||
videos: "some-videos",
|
||||
userData: "some-app-data/some-product-name",
|
||||
currentApp: "/some-current-app",
|
||||
appData: "/some-app-data",
|
||||
cache: "/some-cache",
|
||||
crashDumps: "/some-crash-dumps",
|
||||
desktop: "/some-desktop",
|
||||
documents: "/some-documents",
|
||||
downloads: "/some-downloads",
|
||||
exe: "/some-exe",
|
||||
home: "/some-home-path",
|
||||
logs: "/some-logs",
|
||||
module: "/some-module",
|
||||
music: "/some-music",
|
||||
pictures: "/some-pictures",
|
||||
recent: "/some-recent",
|
||||
temp: "/some-temp",
|
||||
videos: "/some-videos",
|
||||
userData: "/some-app-data/some-product-name",
|
||||
});
|
||||
});
|
||||
|
||||
@ -95,23 +95,23 @@ describe("app-paths", () => {
|
||||
const actual = mainDi.inject(appPathsInjectable);
|
||||
|
||||
expect(actual).toEqual({
|
||||
currentApp: "some-current-app",
|
||||
appData: "some-app-data",
|
||||
cache: "some-cache",
|
||||
crashDumps: "some-crash-dumps",
|
||||
desktop: "some-desktop",
|
||||
documents: "some-documents",
|
||||
downloads: "some-downloads",
|
||||
exe: "some-exe",
|
||||
home: "some-home-path",
|
||||
logs: "some-logs",
|
||||
module: "some-module",
|
||||
music: "some-music",
|
||||
pictures: "some-pictures",
|
||||
recent: "some-recent",
|
||||
temp: "some-temp",
|
||||
videos: "some-videos",
|
||||
userData: "some-app-data/some-product-name",
|
||||
currentApp: "/some-current-app",
|
||||
appData: "/some-app-data",
|
||||
cache: "/some-cache",
|
||||
crashDumps: "/some-crash-dumps",
|
||||
desktop: "/some-desktop",
|
||||
documents: "/some-documents",
|
||||
downloads: "/some-downloads",
|
||||
exe: "/some-exe",
|
||||
home: "/some-home-path",
|
||||
logs: "/some-logs",
|
||||
module: "/some-module",
|
||||
music: "/some-music",
|
||||
pictures: "/some-pictures",
|
||||
recent: "/some-recent",
|
||||
temp: "/some-temp",
|
||||
videos: "/some-videos",
|
||||
userData: "/some-app-data/some-product-name",
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -123,7 +123,7 @@ describe("app-paths", () => {
|
||||
builder.beforeApplicationStart((mainDi) => {
|
||||
mainDi.override(
|
||||
directoryForIntegrationTestingInjectable,
|
||||
() => "some-integration-testing-app-data",
|
||||
() => "/some-integration-testing-app-data",
|
||||
);
|
||||
});
|
||||
|
||||
@ -136,8 +136,8 @@ describe("app-paths", () => {
|
||||
const { appData, userData } = windowDi.inject(appPathsInjectable);
|
||||
|
||||
expect({ appData, userData }).toEqual({
|
||||
appData: "some-integration-testing-app-data",
|
||||
userData: `some-integration-testing-app-data/some-product-name`,
|
||||
appData: "/some-integration-testing-app-data",
|
||||
userData: "/some-integration-testing-app-data/some-product-name",
|
||||
});
|
||||
});
|
||||
|
||||
@ -145,8 +145,8 @@ describe("app-paths", () => {
|
||||
const { appData, userData } = windowDi.inject(appPathsInjectable);
|
||||
|
||||
expect({ appData, userData }).toEqual({
|
||||
appData: "some-integration-testing-app-data",
|
||||
userData: "some-integration-testing-app-data/some-product-name",
|
||||
appData: "/some-integration-testing-app-data",
|
||||
userData: "/some-integration-testing-app-data/some-product-name",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../common/test-utils/get-global-override";
|
||||
import applicationInformationInjectable from "../../common/vars/application-information-injectable";
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import applicationInformationInjectable from "./application-information-injectable";
|
||||
|
||||
export default getGlobalOverride(applicationInformationInjectable, () => ({
|
||||
name: "some-product-name",
|
||||
@ -63,7 +63,7 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {})
|
||||
|
||||
di.register(getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => "test",
|
||||
instantiate: () => "production",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
}));
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ export const getDiForUnitTesting = (
|
||||
|
||||
di.register(getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => "test",
|
||||
instantiate: () => "production",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
}));
|
||||
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../common/test-utils/get-global-override";
|
||||
import applicationInformationInjectable from "../../common/vars/application-information-injectable";
|
||||
|
||||
export default getGlobalOverride(applicationInformationInjectable, () => ({
|
||||
name: "some-product-name",
|
||||
productName: "some-product-name",
|
||||
version: "6.0.0",
|
||||
build: {} as any,
|
||||
config: {
|
||||
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",
|
||||
}));
|
||||
Loading…
Reference in New Issue
Block a user