Files
openclaw/test/scripts/check-docs-mdx.test.ts
2026-06-02 21:25:23 +02:00

26 lines
827 B
TypeScript

import { describe, expect, it } from "vitest";
import { parseArgs } from "../../scripts/check-docs-mdx.mjs";
describe("scripts/check-docs-mdx", () => {
it("parses roots and output options", () => {
expect(parseArgs(["docs", "README.md", "--json-out", "report.json", "--max-errors", "7"]))
.toEqual({
roots: ["docs", "README.md"],
jsonOut: "report.json",
maxErrors: 7,
});
});
it("rejects malformed max error limits", () => {
expect(() => parseArgs(["--max-errors", "2x"])).toThrow(
"--max-errors must be a positive integer",
);
expect(() => parseArgs(["--max-errors", "0"])).toThrow(
"--max-errors must be a positive integer",
);
expect(() => parseArgs(["--max-errors"])).toThrow(
"--max-errors must be a positive integer",
);
});
});