import { describe, expect, test } from "bun:test"; import { parseEditorCommand } from "../editor.js"; describe("parseEditorCommand", () => { test("splits command and args without shell", () => { expect(parseEditorCommand("code --wait")).toEqual({ command: "code", args: ["--wait"] }); }); test("keeps quoted args", () => { expect(parseEditorCommand("vim '+set ft=markdown'")).toEqual({ command: "vim", args: ["+set ft=markdown"] }); }); test("does not interpret shell metacharacters", () => { expect(parseEditorCommand("vim; rm -rf /tmp/nope")).toEqual({ command: "vim;", args: ["rm", "-rf", "/tmp/nope"] }); }); });