Files
openclaw/test/scripts/report-cli-helpers.test.ts
T
Peter Steinberger c70aee247e refactor(scripts): migrate JavaScript tools to TypeScript (#121005)
* refactor(scripts): migrate JavaScript tools to TypeScript

* fix(ci): keep changed-scope preflight zero-install

* fix(ci): preserve zero-install script owners

* fix(ci): complete script migration follow-through

* fix(release): keep stable closeout zero-install

* fix(scripts): preserve standalone execution boundaries

* fix(scripts): repair standalone loader boundaries

* fix(scripts): normalize gateway observation ids

* fix(scripts): keep Docker packager standalone

* test(scripts): preserve rebase cleanup helpers

* test(sessions): use tracked temp directory
2026-08-09 07:21:35 -07:00

48 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { parseReportCliArgs } from "../../scripts/lib/report-cli-helpers.mts";
describe("report-cli-helpers", () => {
it("parses report artifact paths", () => {
expect(
parseReportCliArgs([
"--root",
"/repo",
"--json",
"artifacts/report.json",
"--markdown",
"artifacts/report.md",
]),
).toEqual({
rootDir: "/repo",
jsonPath: "artifacts/report.json",
markdownPath: "artifacts/report.md",
});
});
it("rejects missing report option values", () => {
expect(() => parseReportCliArgs(["--root", "--json", "report.json"])).toThrow(
"Expected --root <value>.",
);
expect(() => parseReportCliArgs(["--root", "-h"])).toThrow("Expected --root <value>.");
expect(() => parseReportCliArgs(["--json"])).toThrow("Expected --json <value>.");
expect(() => parseReportCliArgs(["--json", "--markdown", "report.md"])).toThrow(
"Expected --json <value>.",
);
expect(() => parseReportCliArgs(["--json", "-h"])).toThrow("Expected --json <value>.");
expect(() => parseReportCliArgs(["--markdown", ""])).toThrow("Expected --markdown <value>.");
expect(() => parseReportCliArgs(["--markdown", "-h"])).toThrow("Expected --markdown <value>.");
});
it("rejects duplicate report artifact options", () => {
expect(() => parseReportCliArgs(["--root", "/repo-a", "--root", "/repo-b"])).toThrow(
"--root was provided more than once.",
);
expect(() => parseReportCliArgs(["--json", "first.json", "--json", "second.json"])).toThrow(
"--json was provided more than once.",
);
expect(() => parseReportCliArgs(["--markdown", "first.md", "--markdown", "second.md"])).toThrow(
"--markdown was provided more than once.",
);
});
});