mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 00:11:19 +00:00
fix(test): reject i18n report flag values
This commit is contained in:
parent
d460f00eb9
commit
6c42f73619
2 changed files with 8 additions and 1 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue