mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 10:13:36 +00:00
fix(test): reject i18n report flag values
This commit is contained in:
@@ -128,7 +128,7 @@ export function parseArgs(argv: string[]): ReportArgs {
|
||||
|
||||
function readOptionValue(argv: string[], index: number, flag: string) {
|
||||
const value = argv[index];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`${flag} requires a value`);
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -34,6 +34,13 @@ const entries: RawCopyBaselineEntry[] = [
|
||||
];
|
||||
|
||||
describe("control-ui-i18n report helpers", () => {
|
||||
it.each(["--surface", "--locale", "--top"])(
|
||||
"rejects option-shaped values for %s",
|
||||
(flag) => {
|
||||
expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`);
|
||||
},
|
||||
);
|
||||
|
||||
it("rejects invalid numeric limits", () => {
|
||||
expect(() => parseArgs(["--top", "3abc"])).toThrow("--top must be a positive integer");
|
||||
expect(() => parseArgs(["--top", "1.5"])).toThrow("--top must be a positive integer");
|
||||
|
||||
Reference in New Issue
Block a user