From 116e8c1118140d02e21b04ec9523ca37bb6dc932 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Fri, 10 Jun 2022 17:21:44 +0300 Subject: [PATCH] Add stub value to proxy port to make unrelated tests pass Note: the actual mechanism to set a value for the port is not in scope of behavioral tests yet. Co-authored-by: Janne Savolainen Signed-off-by: Iku-turso # Conflicts: # src/behaviours/quitting-and-restarting-the-app/opening-application-window-using-tray.test.ts # src/main/start-main-application/lens-window/application-window/create-lens-window.injectable.ts --- .../opening-application-window-using-tray.test.ts | 12 +----------- .../test-utils/get-application-builder.tsx | 3 +++ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/behaviours/quitting-and-restarting-the-app/opening-application-window-using-tray.test.ts b/src/behaviours/quitting-and-restarting-the-app/opening-application-window-using-tray.test.ts index e6b19bd00e..7b7765b988 100644 --- a/src/behaviours/quitting-and-restarting-the-app/opening-application-window-using-tray.test.ts +++ b/src/behaviours/quitting-and-restarting-the-app/opening-application-window-using-tray.test.ts @@ -10,15 +10,9 @@ import applicationWindowInjectable from "../../main/start-main-application/lens- import createElectronWindowForInjectable from "../../main/start-main-application/lens-window/application-window/create-electron-window.injectable"; import type { AsyncFnMock } from "@async-fn/jest"; import asyncFn from "@async-fn/jest"; - -import type { - ElectronWindow, - LensWindowConfiguration, -} from "../../main/start-main-application/lens-window/application-window/create-lens-window.injectable"; - +import type { ElectronWindow, LensWindowConfiguration } from "../../main/start-main-application/lens-window/application-window/create-lens-window.injectable"; import type { DiContainer } from "@ogre-tools/injectable"; import { flushPromises } from "../../common/test-utils/flush-promises"; -import lensProxyPortInjectable from "../../main/lens-proxy/lens-proxy-port.injectable"; import lensResourcesDirInjectable from "../../common/vars/lens-resources-dir.injectable"; describe("opening application window using tray", () => { @@ -63,10 +57,6 @@ describe("opening application window using tray", () => { callForSplashWindowHtmlMock = asyncFn(); callForApplicationWindowHtmlMock = asyncFn(); - - const lensProxyPort = mainDi.inject(lensProxyPortInjectable); - - lensProxyPort.set(42); }, ); diff --git a/src/renderer/components/test-utils/get-application-builder.tsx b/src/renderer/components/test-utils/get-application-builder.tsx index f22aecc476..2171b04425 100644 --- a/src/renderer/components/test-utils/get-application-builder.tsx +++ b/src/renderer/components/test-utils/get-application-builder.tsx @@ -56,6 +56,7 @@ import assert from "assert"; import { openMenu } from "react-select-event"; import userEvent from "@testing-library/user-event"; import { StatusBar } from "../status-bar/status-bar"; +import lensProxyPortInjectable from "../../../main/lens-proxy/lens-proxy-port.injectable"; type Callback = (dis: DiContainers) => void | Promise; @@ -398,6 +399,8 @@ export const getApplicationBuilder = () => { }, async render() { + mainDi.inject(lensProxyPortInjectable).set(42); + for (const callback of beforeApplicationStartCallbacks) { await callback(dis); }