summaryrefslogtreecommitdiff
path: root/tests/steamLaunchOptions.test.ts
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-10 14:59:56 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-10 14:59:56 -0400
commitbe1feeee76cf4956bc5456e4b2740930750fbedf (patch)
tree32f08835271fd92f99d6be699bf7cbde81a2060c /tests/steamLaunchOptions.test.ts
parent1e97e741ae89270801526234e3caaf5c7aacdca7 (diff)
downloaddecky-lsfg-vk-be1feeee76cf4956bc5456e4b2740930750fbedf.tar.gz
decky-lsfg-vk-be1feeee76cf4956bc5456e4b2740930750fbedf.zip
fix: recognize split Steam Flatpak targets
Diffstat (limited to 'tests/steamLaunchOptions.test.ts')
-rw-r--r--tests/steamLaunchOptions.test.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/steamLaunchOptions.test.ts b/tests/steamLaunchOptions.test.ts
index 049f6be..1a6069f 100644
--- a/tests/steamLaunchOptions.test.ts
+++ b/tests/steamLaunchOptions.test.ts
@@ -8,6 +8,7 @@ import {
installWrapperIntegration,
installWrapperLaunchOption,
isLegacyWrapperToken,
+ normalizeShortcutTarget,
normalizeLaunchOptions,
readSteamLaunchOptions,
removeWrapperIntegration,
@@ -16,6 +17,12 @@ import {
const wrapper = "~/.lsfg";
+test("normalizes Steam's split direct Flatpak target representation", () => {
+ assert.equal(normalizeShortcutTarget("flatpak", "/usr/bin/"), "/usr/bin/flatpak");
+ assert.equal(normalizeShortcutTarget("flatpak", "/usr/bin"), "/usr/bin/flatpak");
+ assert.equal(normalizeShortcutTarget("flatpak", "/home/deck/"), "flatpak");
+});
+
test("inserts one wrapper immediately before an existing command macro", () => {
assert.deepEqual(installWrapperLaunchOption('gamemoderun %command% --profile "high quality"', wrapper), {
options: 'gamemoderun ~/.lsfg %command% --profile "high quality"',
@@ -144,6 +151,47 @@ test("reads the matching app-details field and installs/removes Steam integratio
}
});
+test("wraps a split direct Flatpak target while preserving its launch arguments", async () => {
+ const previousWindow = (globalThis as Record<string, unknown>).window;
+ const previousSteamClient = (globalThis as Record<string, unknown>).SteamClient;
+ let shortcutTarget = "flatpak";
+ const shortcutOptions = '"run" "--branch=master" "io.github.banjorecomp.banjorecomp"';
+ const targetWrites: string[] = [];
+ const apps = {
+ RegisterForAppDetails(_appId: number, callback: (details: SteamAppDetails) => void) {
+ callback({
+ strShortcutExe: shortcutTarget,
+ strShortcutStartDir: "/usr/bin/",
+ strShortcutLaunchOptions: shortcutOptions,
+ });
+ return { unregister() {} };
+ },
+ SetShortcutExe(_appId: number, executable: string) {
+ targetWrites.push(executable);
+ shortcutTarget = executable;
+ },
+ SetShortcutLaunchOptions() {},
+ };
+ (globalThis as Record<string, unknown>).window = { setTimeout, clearTimeout };
+ (globalThis as Record<string, unknown>).SteamClient = { Apps: apps };
+ try {
+ const installed = await installWrapperIntegration(46, true, wrapper, false, { kind: "flatpak" });
+ assert.equal(installed.originalExecutable, "/usr/bin/flatpak");
+ assert.equal(installed.snapshot.target, '"~/.lsfg" "/usr/bin/flatpak"');
+ assert.equal(installed.snapshot.options, shortcutOptions);
+ assert.deepEqual(targetWrites, ['"~/.lsfg" "/usr/bin/flatpak"']);
+
+ const restored = await removeWrapperIntegration(46, true, wrapper, installed.originalExecutable, false, { kind: "flatpak" });
+ assert.equal(restored.target, "/usr/bin/flatpak");
+ assert.deepEqual(targetWrites, ['"~/.lsfg" "/usr/bin/flatpak"', "/usr/bin/flatpak"]);
+ } finally {
+ if (previousWindow === undefined) delete (globalThis as Record<string, unknown>).window;
+ else (globalThis as Record<string, unknown>).window = previousWindow;
+ if (previousSteamClient === undefined) delete (globalThis as Record<string, unknown>).SteamClient;
+ else (globalThis as Record<string, unknown>).SteamClient = previousSteamClient;
+ }
+});
+
test("uses shortcut launch options for a host shortcut without changing its Target", async () => {
const previousWindow = (globalThis as Record<string, unknown>).window;
const previousSteamClient = (globalThis as Record<string, unknown>).SteamClient;