mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Replace static application window with ability to create many (#5979)
* Replace static application window with ability to create as many as you wish Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Adapt tests for replacing static application window with ability to create as many as you wish and separate starting of main and window in behaviours Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make first render of application smaller in test that proves to be hard for CI Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove redundant code Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Simplify code Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
299922c8a7
commit
63d5a34379
98 files changed
+3283
-2743
No files matched your search
@@ -14,15 +14,10 @@ import { getApplicationBuilder } from "../../renderer/components/test-utils/get-
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
|
||||
describe("app-paths", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let rendererDi: DiContainer;
|
||||
let mainDi: DiContainer;
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
rendererDi = applicationBuilder.dis.rendererDi;
|
||||
mainDi = applicationBuilder.dis.mainDi;
|
||||
builder = getApplicationBuilder();
|
||||
|
||||
const defaultAppPathsStub: AppPaths = {
|
||||
appData: "some-app-data",
|
||||
@@ -43,7 +38,7 @@ describe("app-paths", () => {
|
||||
userData: "some-irrelevant-user-data",
|
||||
};
|
||||
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
builder.beforeApplicationStart((mainDi) => {
|
||||
mainDi.override(
|
||||
getElectronAppPathInjectable,
|
||||
() =>
|
||||
@@ -64,12 +59,18 @@ describe("app-paths", () => {
|
||||
});
|
||||
|
||||
describe("normally", () => {
|
||||
let windowDi: DiContainer;
|
||||
let mainDi: DiContainer;
|
||||
|
||||
beforeEach(async () => {
|
||||
await applicationBuilder.render();
|
||||
await builder.render();
|
||||
|
||||
windowDi = builder.applicationWindow.only.di;
|
||||
mainDi = builder.mainDi;
|
||||
});
|
||||
|
||||
it("given in renderer, when injecting app paths, returns application specific app paths", () => {
|
||||
const actual = rendererDi.inject(appPathsInjectionToken);
|
||||
const actual = windowDi.inject(appPathsInjectionToken);
|
||||
|
||||
expect(actual).toEqual({
|
||||
appData: "some-app-data",
|
||||
@@ -116,19 +117,23 @@ describe("app-paths", () => {
|
||||
});
|
||||
|
||||
describe("when running integration tests", () => {
|
||||
let windowDi: DiContainer;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
builder.beforeApplicationStart((mainDi) => {
|
||||
mainDi.override(
|
||||
directoryForIntegrationTestingInjectable,
|
||||
() => "some-integration-testing-app-data",
|
||||
);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
await builder.render();
|
||||
|
||||
windowDi = builder.applicationWindow.only.di;
|
||||
});
|
||||
|
||||
it("given in renderer, when injecting path for app data, has integration specific app data path", () => {
|
||||
const { appData, userData } = rendererDi.inject(appPathsInjectionToken);
|
||||
const { appData, userData } = windowDi.inject(appPathsInjectionToken);
|
||||
|
||||
expect({ appData, userData }).toEqual({
|
||||
appData: "some-integration-testing-app-data",
|
||||
@@ -137,7 +142,7 @@ describe("app-paths", () => {
|
||||
});
|
||||
|
||||
it("given in main, when injecting path for app data, has integration specific app data path", () => {
|
||||
const { appData, userData } = rendererDi.inject(appPathsInjectionToken);
|
||||
const { appData, userData } = windowDi.inject(appPathsInjectionToken);
|
||||
|
||||
expect({ appData, userData }).toEqual({
|
||||
appData: "some-integration-testing-app-data",
|
||||
|
||||
Reference in new issue
Block a user