mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-09 04:22:53 +00:00
fix(cli): reject malformed timeout values
This commit is contained in:
@@ -1926,10 +1926,56 @@ describe("capability cli", () => {
|
||||
argv: ["capability", "image", "generate", "--prompt", "portrait", "--timeout-ms", "1000ms"],
|
||||
}),
|
||||
).rejects.toThrow("exit 1");
|
||||
expectRuntimeErrorContains("--timeout-ms must be a finite number");
|
||||
expectRuntimeErrorContains("Invalid --timeout. Use a positive millisecond value");
|
||||
expect(mocks.generateImage).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
"image generate",
|
||||
["capability", "image", "generate", "--prompt", "portrait", "--timeout-ms", "1000ms"],
|
||||
],
|
||||
[
|
||||
"image edit",
|
||||
[
|
||||
"capability",
|
||||
"image",
|
||||
"edit",
|
||||
"--file",
|
||||
"photo.png",
|
||||
"--prompt",
|
||||
"crop it",
|
||||
"--timeout-ms",
|
||||
"1000ms",
|
||||
],
|
||||
],
|
||||
[
|
||||
"image describe",
|
||||
["capability", "image", "describe", "--file", "photo.png", "--timeout-ms", "1000ms"],
|
||||
],
|
||||
[
|
||||
"image describe-many",
|
||||
["capability", "image", "describe-many", "--file", "photo.png", "--timeout-ms", "1000ms"],
|
||||
],
|
||||
[
|
||||
"video generate",
|
||||
["capability", "video", "generate", "--prompt", "clip", "--timeout-ms", "1000ms"],
|
||||
],
|
||||
])("rejects malformed %s timeout before provider dispatch", async (_name, argv) => {
|
||||
await expect(
|
||||
runRegisteredCli({
|
||||
register: registerCapabilityCli as (program: Command) => void,
|
||||
argv,
|
||||
}),
|
||||
).rejects.toThrow("exit 1");
|
||||
|
||||
expectRuntimeErrorContains("Invalid --timeout. Use a positive millisecond value");
|
||||
expect(mocks.generateImage).not.toHaveBeenCalled();
|
||||
expect(mocks.generateVideo).not.toHaveBeenCalled();
|
||||
expect(mocks.describeImageFile).not.toHaveBeenCalled();
|
||||
expect(mocks.describeImageFileWithModel).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("routes audio transcribe through transcription, not realtime", async () => {
|
||||
await runRegisteredCli({
|
||||
register: registerCapabilityCli as (program: Command) => void,
|
||||
|
||||
Reference in New Issue
Block a user