From 340d6597cc382295f360781abb1b771d51a9e060 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Sat, 22 Aug 2026 19:51:44 +0200 Subject: [PATCH] test(window): cover dark native theme in main process Extend the Electron main-process mock with nativeTheme and verify startup forces the dark title-bar contract. --- tests/main-shutdown-lifecycle.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/main-shutdown-lifecycle.test.ts b/tests/main-shutdown-lifecycle.test.ts index e029138..ac71c78 100644 --- a/tests/main-shutdown-lifecycle.test.ts +++ b/tests/main-shutdown-lifecycle.test.ts @@ -7,6 +7,7 @@ const electron = vi.hoisted(() => { const handlers = new Map void>(); return { handlers, + nativeTheme: { themeSource: "system" }, app: { isPackaged: false, getPath: vi.fn(() => "C:\\MDD\\Test"), @@ -30,6 +31,7 @@ vi.mock("electron", () => ({ dialog: {}, ipcMain: { handle: vi.fn(), on: vi.fn() }, Menu: { buildFromTemplate: vi.fn(), setApplicationMenu: vi.fn() }, + nativeTheme: electron.nativeTheme, safeStorage: { isEncryptionAvailable: () => false, encryptString: vi.fn(), decryptString: vi.fn() }, shell: { openExternal: vi.fn() }, Tray: class {} @@ -255,6 +257,7 @@ describe("main shutdown lifecycle", () => { it("prevents quit once, waits for shutdown, then allows exactly one loop-free quit", async () => { const main = await import("../src/main/main"); + expect(electron.nativeTheme.themeSource).toBe("dark"); const shutdown = deferred(); const cleanup = vi.fn(); const continueQuit = vi.fn();