import { describe, expect, it } from "vitest"; import { planGoTestFromSlashArgs } from "./plan-go-test-from-slash-args.ts"; describe("planGoTestFromSlashArgs", () => { const cwd = "/workspace/service"; it("builds the default Go test plan from an empty slash-command tail", () => { const plan = planGoTestFromSlashArgs({ argsTail: "", cwd }); expect(plan).toMatchObject({ language: "go", cwd, command: "go", args: ["test", "-race", "./..."], displayCommand: "go test -race ./...", }); }); it.each([["--tags contract,e2e"], ["--tags=contract,e2e"], ["contract,e2e"]])( "builds a tagged Go test plan from tail %j", (argsTail: string) => { const plan = planGoTestFromSlashArgs({ argsTail, cwd }); expect(plan).toMatchObject({ language: "go", cwd, command: "go", args: ["test", "-race", "-tags=contract,e2e", "./..."], displayCommand: "go test -race -tags=contract,e2e ./...", }); }, ); it.each(["--tags", "--tags="])( "rejects %j without a value", (argsTail: string) => { expect(() => planGoTestFromSlashArgs({ argsTail, cwd })).toThrow(/tags/i); }, ); it("rejects unsafe tags at planning level", () => { expect(() => planGoTestFromSlashArgs({ argsTail: "--tags contract;e2e", cwd }), ).toThrow(/tags/i); }); });