From a7b7e22968480c0b57f9a0335ee30e27baa9b88d Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 10 Sep 2026 15:11:51 -0400 Subject: fix: canonicalize existing Flatpak targets --- tests/steamLaunchOptions.test.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests/steamLaunchOptions.test.ts') diff --git a/tests/steamLaunchOptions.test.ts b/tests/steamLaunchOptions.test.ts index 0559330..cdf0cf2 100644 --- a/tests/steamLaunchOptions.test.ts +++ b/tests/steamLaunchOptions.test.ts @@ -192,6 +192,37 @@ test("wraps a split direct Flatpak target while preserving its launch arguments" } }); +test("canonicalizes an existing quoted direct Flatpak target", async () => { + const previousWindow = (globalThis as Record).window; + const previousSteamClient = (globalThis as Record).SteamClient; + let shortcutTarget = '"~/.lsfg" "/usr/bin/flatpak"'; + const targetWrites: string[] = []; + const apps = { + RegisterForAppDetails(_appId: number, callback: (details: SteamAppDetails) => void) { + callback({ strShortcutExe: shortcutTarget, strShortcutLaunchOptions: "" }); + return { unregister() {} }; + }, + SetShortcutExe(_appId: number, executable: string) { + targetWrites.push(executable); + shortcutTarget = executable; + }, + SetShortcutLaunchOptions() {}, + }; + (globalThis as Record).window = { setTimeout, clearTimeout }; + (globalThis as Record).SteamClient = { Apps: apps }; + try { + const installed = await installWrapperIntegration(47, true, wrapper, false, { kind: "flatpak" }); + assert.equal(installed.originalExecutable, "/usr/bin/flatpak"); + assert.equal(installed.snapshot.target, "~/.lsfg /usr/bin/flatpak"); + assert.deepEqual(targetWrites, ["~/.lsfg /usr/bin/flatpak"]); + } finally { + if (previousWindow === undefined) delete (globalThis as Record).window; + else (globalThis as Record).window = previousWindow; + if (previousSteamClient === undefined) delete (globalThis as Record).SteamClient; + else (globalThis as Record).SteamClient = previousSteamClient; + } +}); + test("uses shortcut launch options for a host shortcut without changing its Target", async () => { const previousWindow = (globalThis as Record).window; const previousSteamClient = (globalThis as Record).SteamClient; -- cgit v1.2.3