1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

tray and menu passing tests and lint

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

View File

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

View File

@ -46,8 +46,8 @@ describe("installing update using tray", () => {
mainDi.override(publishIsConfiguredInjectable, () => true);
mainDi.override(
showMessagePopupInjectable,
() => showMessagePopupMock,
showMessagePopupInjectable,
() => showMessagePopupMock,
);
});
@ -176,10 +176,10 @@ describe("installing update using tray", () => {
it("it displays a popup", () => {
expect(showMessagePopupMock).toHaveBeenCalledWith(
"No Updates Available",
"You're all good",
"You've got the latest version of Lens,\nthanks for staying on the ball.",
{ "textWidth": 300 }
"No Updates Available",
"You're all good",
"You've got the latest version of Lens,\nthanks for staying on the ball.",
{ "textWidth": 300 },
);
});