editor/apps/desktop/src/squirrel.test.ts
konstantin-paulus 46cef22b26 Enhance Windows support and update dependencies
- Added support for Squirrel.Windows in the desktop app, including configuration for the installer and metadata.
- Updated package-lock.json to include the latest version of @electron-forge/maker-squirrel and other dependencies.
- Modified build scripts to improve compatibility and streamline installation processes.
- Documented the current status of Windows implementation in WINDOWS.md, outlining next steps for CI integration.
2026-09-16 10:53:54 +02:00

35 lines
1.5 KiB
TypeScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Which launches are Squirrel housekeeping: only the four event flags, only
// on Windows, and only as the first argument, where Squirrel puts them. A
// deep link or `--hidden` in that position is a real launch.
import { describe, expect, it, vi } from "vitest";
vi.mock("electron", () => ({ app: { quit: () => {} } }));
const { squirrelEvent } = await import("./squirrel");
const exe = "C:\\Users\\me\\AppData\\Local\\DiffusionStudio\\app-1.0.0\\Diffusion Studio.exe";
describe("squirrelEvent", () => {
it("recognises each event flag on Windows", () => {
for (const flag of ["--squirrel-install", "--squirrel-updated", "--squirrel-uninstall", "--squirrel-obsolete"]) {
expect(squirrelEvent([exe, flag, "1.0.0"], "win32")).toBe(flag);
}
});
it("treats the first run and ordinary launches as launches", () => {
expect(squirrelEvent([exe, "--squirrel-firstrun"], "win32")).toBeNull();
expect(squirrelEvent([exe], "win32")).toBeNull();
expect(squirrelEvent([exe, "--hidden"], "win32")).toBeNull();
expect(squirrelEvent([exe, "diffusion://auth?x=1"], "win32")).toBeNull();
});
it("is never an event off Windows", () => {
expect(squirrelEvent(["/Applications/Diffusion Studio.app/Contents/MacOS/Diffusion Studio", "--squirrel-install"], "darwin")).toBeNull();
});
});