tray and menu passing tests and lint

Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
Gabriel committed 2023-04-03 20:09:30 +02:00
1 parent a6add7a4c5
commit afcdda78ff
2 files changed
+22 -14

No files matched your search

@@ -12,6 +12,10 @@ import checkForPlatformUpdatesInjectable from "../../main/check-for-updates/chec
import type { RenderResult } from "@testing-library/react"; import type { RenderResult } from "@testing-library/react";
import showMessagePopupInjectable from "../../../../main/electron-app/features/show-message-popup.injectable"; import showMessagePopupInjectable from "../../../../main/electron-app/features/show-message-popup.injectable";
import type { ShowMessagePopup } from "../../../../main/electron-app/features/show-message-popup.injectable"; import type { ShowMessagePopup } from "../../../../main/electron-app/features/show-message-popup.injectable";
import electronUpdaterIsActiveInjectable
from "../../../../main/electron-app/features/electron-updater-is-active.injectable";
import publishIsConfiguredInjectable
from "../../main/updating-is-enabled/publish-is-configured/publish-is-configured.injectable";
describe("installing update using application menu", () => { describe("installing update using application menu", () => {
let applicationBuilder: ApplicationBuilder; let applicationBuilder: ApplicationBuilder;
@@ -22,14 +26,19 @@ describe("installing update using application menu", () => {
applicationBuilder = getApplicationBuilder(); applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(({ mainDi }) => { applicationBuilder.beforeApplicationStart(({ mainDi }) => {
checkForPlatformUpdatesMock = asyncFn(); checkForPlatformUpdatesMock = asyncFn();
showMessagePopupMock = asyncFn();
mainDi.override( mainDi.override(
checkForPlatformUpdatesInjectable, checkForPlatformUpdatesInjectable,
() => checkForPlatformUpdatesMock, () => checkForPlatformUpdatesMock,
); );
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
mainDi.override(publishIsConfiguredInjectable, () => true);
mainDi.override( mainDi.override(
showMessagePopupInjectable, showMessagePopupInjectable,
() => showMessagePopupMock, () => showMessagePopupMock,
); );
}); });
}); });
@@ -49,7 +58,7 @@ describe("installing update using application menu", () => {
beforeEach(() => { beforeEach(() => {
applicationBuilder.applicationMenu.click( applicationBuilder.applicationMenu.click(
"root", "root",
"help", "mac",
"check-for-updates", "check-for-updates",
); );
}); });
@@ -62,13 +71,12 @@ describe("installing update using application menu", () => {
it("it displays a popup", () => { it("it displays a popup", () => {
expect(showMessagePopupMock).toHaveBeenCalledWith( expect(showMessagePopupMock).toHaveBeenCalledWith(
"No Updates Available", "No Updates Available",
"You're all good", "You're all good",
"You've got the latest version of Lens,\nthanks for staying on the ball.", "You've got the latest version of Lens,\nthanks for staying on the ball.",
{ "textWidth": 300 } { "textWidth": 300 },
); );
}); });
}); });
}); });
}); });
@@ -46,8 +46,8 @@ describe("installing update using tray", () => {
mainDi.override(publishIsConfiguredInjectable, () => true); mainDi.override(publishIsConfiguredInjectable, () => true);
mainDi.override( mainDi.override(
showMessagePopupInjectable, showMessagePopupInjectable,
() => showMessagePopupMock, () => showMessagePopupMock,
); );
}); });
@@ -176,10 +176,10 @@ describe("installing update using tray", () => {
it("it displays a popup", () => { it("it displays a popup", () => {
expect(showMessagePopupMock).toHaveBeenCalledWith( expect(showMessagePopupMock).toHaveBeenCalledWith(
"No Updates Available", "No Updates Available",
"You're all good", "You're all good",
"You've got the latest version of Lens,\nthanks for staying on the ball.", "You've got the latest version of Lens,\nthanks for staying on the ball.",
{ "textWidth": 300 } { "textWidth": 300 },
); );
}); });