fix(test): reject i18n report flag values · openclaw/openclaw@6c42f73
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -128,7 +128,7 @@ export function parseArgs(argv: string[]): ReportArgs {
|
128 | 128 | |
129 | 129 | function readOptionValue(argv: string[], index: number, flag: string) { |
130 | 130 | const value = argv[index]; |
131 | | -if (!value || value.startsWith("--")) { |
| 131 | +if (!value || value.startsWith("-")) { |
132 | 132 | throw new Error(`${flag} requires a value`); |
133 | 133 | } |
134 | 134 | return value; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,6 +34,13 @@ const entries: RawCopyBaselineEntry[] = [
|
34 | 34 | ]; |
35 | 35 | |
36 | 36 | describe("control-ui-i18n report helpers", () => { |
| 37 | +it.each(["--surface", "--locale", "--top"])( |
| 38 | +"rejects option-shaped values for %s", |
| 39 | +(flag) => { |
| 40 | +expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`); |
| 41 | +}, |
| 42 | +); |
| 43 | + |
37 | 44 | it("rejects invalid numeric limits", () => { |
38 | 45 | expect(() => parseArgs(["--top", "3abc"])).toThrow("--top must be a positive integer"); |
39 | 46 | expect(() => parseArgs(["--top", "1.5"])).toThrow("--top must be a positive integer"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。