From 2b19930f579750be9204587b2ba0f6539224ed03 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Tue, 31 May 2022 15:16:57 +0300 Subject: [PATCH] Make linter happy Signed-off-by: Alex Andreev --- src/common/__tests__/timezones.test.ts | 2 +- src/jest.timezone.ts | 2 +- src/main/app-updater.ts | 2 +- .../__tests__/app-update-warning.test.ts | 11 ++++++----- src/renderer/components/layout/top-bar/top-bar.tsx | 2 +- .../update-button/__tests__/update-button.test.tsx | 4 +++- .../update-button/update-app.injectable.ts | 4 ++-- src/renderer/utils/session-storage.injectable.ts | 12 ++++++------ 8 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/common/__tests__/timezones.test.ts b/src/common/__tests__/timezones.test.ts index 6d66803a04..e7fa68e87c 100644 --- a/src/common/__tests__/timezones.test.ts +++ b/src/common/__tests__/timezones.test.ts @@ -9,4 +9,4 @@ describe("Timezones", () => { }); }); -export {}; \ No newline at end of file +export {}; diff --git a/src/jest.timezone.ts b/src/jest.timezone.ts index 3aa7fef0c0..ec39a810e3 100644 --- a/src/jest.timezone.ts +++ b/src/jest.timezone.ts @@ -8,4 +8,4 @@ module.exports = async () => { process.env.TZ = "UTC"; }; -export {}; \ No newline at end of file +export {}; diff --git a/src/main/app-updater.ts b/src/main/app-updater.ts index e3c2fe1146..bb373f6e95 100644 --- a/src/main/app-updater.ts +++ b/src/main/app-updater.ts @@ -134,4 +134,4 @@ export async function checkForUpdates(): Promise { export function quitAndInstallUpdate() { autoUpdater.quitAndInstall(true, true); -} \ No newline at end of file +} diff --git a/src/renderer/app-update-warning/__tests__/app-update-warning.test.ts b/src/renderer/app-update-warning/__tests__/app-update-warning.test.ts index e46a6deba0..29f658fcd6 100644 --- a/src/renderer/app-update-warning/__tests__/app-update-warning.test.ts +++ b/src/renderer/app-update-warning/__tests__/app-update-warning.test.ts @@ -21,7 +21,7 @@ describe("app-update-warning", () => { if (event === "update-available") { callback(); } - } + }, } as never)); di.override(sessionStorageInjectable, () => ({ @@ -90,7 +90,7 @@ describe("app-update-warning", () => { afterAll(() => { jest.useRealTimers(); - }) + }); it(`returns light warning level if date is ${date}`, () => { expect(appUpdateWarning.warningLevel).toBe("light"); @@ -105,7 +105,7 @@ describe("app-update-warning", () => { afterAll(() => { jest.useRealTimers(); - }) + }); it(`returns medium warning level if date is ${date}`, () => { expect(appUpdateWarning.warningLevel).toBe("medium"); @@ -120,7 +120,7 @@ describe("app-update-warning", () => { afterAll(() => { jest.useRealTimers(); - }) + }); it(`returns medium warning level if date is ${date}`, () => { expect(appUpdateWarning.warningLevel).toBe("high"); @@ -138,7 +138,7 @@ describe("app-update-warning", () => { appUpdateWarning = di.inject(appUpdateWarningInjectable); appUpdateWarning.init(); - }) + }); afterEach(() => { jest.useRealTimers(); @@ -146,6 +146,7 @@ describe("app-update-warning", () => { it("calls setInterval with correct arguments", () => { const onceADay = 1000 * 60 * 60 * 24; + expect(setInterval).toHaveBeenCalledTimes(1); expect(setInterval).toHaveBeenCalledWith(expect.any(Function), onceADay); }); diff --git a/src/renderer/components/layout/top-bar/top-bar.tsx b/src/renderer/components/layout/top-bar/top-bar.tsx index 76ef857db8..adb378c4a7 100644 --- a/src/renderer/components/layout/top-bar/top-bar.tsx +++ b/src/renderer/components/layout/top-bar/top-bar.tsx @@ -11,7 +11,7 @@ import { Icon } from "../../icon"; import { observable } from "mobx"; import { ipcRendererOn } from "../../../../common/ipc"; import { watchHistoryState } from "../../../remote-helpers/history-updater"; -import { cssNames, noop } from "../../../utils"; +import { cssNames } from "../../../utils"; import topBarItemsInjectable from "./top-bar-items/top-bar-items.injectable"; import { withInjectables } from "@ogre-tools/injectable-react"; import type { TopBarRegistration } from "./top-bar-registration"; diff --git a/src/renderer/components/update-button/__tests__/update-button.test.tsx b/src/renderer/components/update-button/__tests__/update-button.test.tsx index fbb91adf36..f410c9eae8 100644 --- a/src/renderer/components/update-button/__tests__/update-button.test.tsx +++ b/src/renderer/components/update-button/__tests__/update-button.test.tsx @@ -10,7 +10,8 @@ import "@testing-library/jest-dom/extend-expect"; import type { DiContainer } from "@ogre-tools/injectable"; import appUpdateWarningLevelInjectable from "../../../app-update-warning/app-update-warning-level.injectable"; import { computed } from "mobx"; -import { DiRender, renderFor } from "../../test-utils/renderFor"; +import type { DiRender } from "../../test-utils/renderFor"; +import { renderFor } from "../../test-utils/renderFor"; import updateAppInjectable from "../update-app.injectable"; import { getDiForUnitTesting } from "../../../getDiForUnitTesting"; @@ -55,6 +56,7 @@ describe("", () => { it("should call update function when menu item clicked", () => { const update = jest.fn(); + di.override(appUpdateWarningLevelInjectable, () => computed(() => "light")); di.override(updateAppInjectable, update); diff --git a/src/renderer/components/update-button/update-app.injectable.ts b/src/renderer/components/update-button/update-app.injectable.ts index 65e46fa87e..c185d5143a 100644 --- a/src/renderer/components/update-button/update-app.injectable.ts +++ b/src/renderer/components/update-button/update-app.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; -import { AutoUpdateQuitAndInstalledChannel } from "../../../common/ipc"; +import { AutoUpdateQuitAndInstalledChannel } from "../../../common/ipc/update-available"; import broadcastMessageInjectable from "../../../common/ipc/broadcast-message.injectable"; const updateAppInjectable = getInjectable({ @@ -17,4 +17,4 @@ const updateAppInjectable = getInjectable({ }, }); -export default updateAppInjectable; \ No newline at end of file +export default updateAppInjectable; diff --git a/src/renderer/utils/session-storage.injectable.ts b/src/renderer/utils/session-storage.injectable.ts index 9d4580e297..8af2bd8692 100644 --- a/src/renderer/utils/session-storage.injectable.ts +++ b/src/renderer/utils/session-storage.injectable.ts @@ -2,11 +2,11 @@ * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ - import { getInjectable } from "@ogre-tools/injectable"; +import { getInjectable } from "@ogre-tools/injectable"; - const sessionStorageInjectable = getInjectable({ - id: "session-storage", - instantiate: () => window.sessionStorage, - }); +const sessionStorageInjectable = getInjectable({ + id: "session-storage", + instantiate: () => window.sessionStorage, +}); - export default sessionStorageInjectable; \ No newline at end of file +export default sessionStorageInjectable;