From 767609532fd920931b9d17dc9bed9b695e20eb53 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Mar 2026 00:30:10 +0000 Subject: [PATCH] test: tighten system run command coverage --- src/infra/system-run-command.test.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/infra/system-run-command.test.ts b/src/infra/system-run-command.test.ts index ea3ec9ffdf5..4b8e8043eee 100644 --- a/src/infra/system-run-command.test.ts +++ b/src/infra/system-run-command.test.ts @@ -182,6 +182,30 @@ describe("system run command helpers", () => { expect(res.details?.code).toBe("MISSING_COMMAND"); }); + test("resolveSystemRunCommand returns an empty success payload when no command is provided", () => { + const res = resolveSystemRunCommand({}); + expect(res.ok).toBe(true); + if (!res.ok) { + throw new Error("unreachable"); + } + expect(res.argv).toEqual([]); + expect(res.commandText).toBe(""); + expect(res.shellPayload).toBeNull(); + expect(res.previewText).toBeNull(); + }); + + test("resolveSystemRunCommand stringifies non-string argv tokens", () => { + const res = resolveSystemRunCommand({ + command: ["echo", 123, false, null], + }); + expect(res.ok).toBe(true); + if (!res.ok) { + throw new Error("unreachable"); + } + expect(res.argv).toEqual(["echo", "123", "false", "null"]); + expect(res.commandText).toBe("echo 123 false null"); + }); + test("resolveSystemRunCommandRequest accepts legacy shell payloads but returns canonical command text", () => { const res = resolveSystemRunCommandRequest({ command: ["cmd.exe", "/d", "/s", "/c", "echo", "SAFE&&whoami"],