mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-23 03:48:09 +00:00
fix(perf): require source summary path values
This commit is contained in:
32
test/scripts/openclaw-performance-source-summary.test.ts
Normal file
32
test/scripts/openclaw-performance-source-summary.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseArgs } from "../../scripts/openclaw-performance-source-summary.mjs";
|
||||
|
||||
describe("parseArgs", () => {
|
||||
it("parses source summary paths", () => {
|
||||
expect(
|
||||
parseArgs([
|
||||
"--source-dir",
|
||||
"reports/current",
|
||||
"--baseline-source-dir",
|
||||
"reports/baseline",
|
||||
"--output",
|
||||
"summary.md",
|
||||
]),
|
||||
).toEqual({
|
||||
sourceDir: path.resolve("reports/current"),
|
||||
baselineSourceDir: path.resolve("reports/baseline"),
|
||||
output: path.resolve("summary.md"),
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects missing path values", () => {
|
||||
for (const flag of ["--source-dir", "--baseline-source-dir", "--output"]) {
|
||||
expect(() => parseArgs([flag])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, ""])).toThrow(`${flag} requires a value`);
|
||||
expect(() => parseArgs([flag, "--source-dir", "reports/current"])).toThrow(
|
||||
`${flag} requires a value`,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user