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:
Janne Savolainen authored and GitHub committed 2022-08-16 15:55:42 +03:00
1 parent 299922c8a7
commit 63d5a34379
98 files changed
+3283 -2743

No files matched your search

@@ -19,7 +19,7 @@ import showErrorNotificationInjectable from "../../renderer/components/notificat
import type { AsyncResult } from "../../common/utils/async-result";
describe("add custom helm repository in preferences", () => {
let applicationBuilder: ApplicationBuilder;
let builder: ApplicationBuilder;
let showSuccessNotificationMock: jest.Mock;
let showErrorNotificationMock: jest.Mock;
let rendered: RenderResult;
@@ -31,41 +31,35 @@ describe("add custom helm repository in preferences", () => {
beforeEach(async () => {
jest.useFakeTimers();
applicationBuilder = getApplicationBuilder();
builder = getApplicationBuilder();
execFileMock = asyncFn();
getActiveHelmRepositoriesMock = asyncFn();
showSuccessNotificationMock = jest.fn();
showErrorNotificationMock = jest.fn();
applicationBuilder.beforeApplicationStart(({ mainDi, rendererDi }) => {
rendererDi.override(callForPublicHelmRepositoriesInjectable, () => async () => []);
showSuccessNotificationMock = jest.fn();
rendererDi.override(showSuccessNotificationInjectable, () => showSuccessNotificationMock);
showErrorNotificationMock = jest.fn();
rendererDi.override(showErrorNotificationInjectable, () => showErrorNotificationMock);
// TODO: Figure out how to make async validators unit testable
rendererDi.override(isPathInjectable, () => ({ debounce: 0, validate: async () => {} }));
mainDi.override(
getActiveHelmRepositoriesInjectable,
() => getActiveHelmRepositoriesMock,
);
builder.beforeApplicationStart((mainDi) => {
mainDi.override(getActiveHelmRepositoriesInjectable, () => getActiveHelmRepositoriesMock);
mainDi.override(execFileInjectable, () => execFileMock);
mainDi.override(helmBinaryPathInjectable, () => "some-helm-binary-path");
});
rendered = await applicationBuilder.render();
builder.beforeWindowStart((windowDi) => {
windowDi.override(callForPublicHelmRepositoriesInjectable, () => async () => []);
windowDi.override(showSuccessNotificationInjectable, () => showSuccessNotificationMock);
windowDi.override(showErrorNotificationInjectable, () => showErrorNotificationMock);
// TODO: Figure out how to make async validators unit testable
windowDi.override(isPathInjectable, () => ({ debounce: 0, validate: async () => {} }));
});
rendered = await builder.render();
});
describe("when navigating to preferences containing helm repositories", () => {
beforeEach(async () => {
applicationBuilder.preferences.navigate();
applicationBuilder.preferences.navigation.click("kubernetes");
builder.preferences.navigate();
builder.preferences.navigation.click("kubernetes");
});
it("renders", () => {