test: guard program smoke mock calls · openclaw/openclaw@976593b
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -52,13 +52,13 @@ describe("cli program (smoke)", () => {
|
52 | 52 | |
53 | 53 | it("runs tui with explicit timeout override", async () => { |
54 | 54 | await runProgram(["tui", "--timeout-ms", "45000"]); |
55 | | -const options = runTui.mock.calls[0]?.[0] as { timeoutMs?: number } | undefined; |
| 55 | +const options = runTui.mock.calls.at(0)?.[0] as { timeoutMs?: number } | undefined; |
56 | 56 | expect(options?.timeoutMs).toBe(45000); |
57 | 57 | }); |
58 | 58 | |
59 | 59 | it("runs crestodian one-shot requests", async () => { |
60 | 60 | await runProgram(["crestodian", "--message", "status"]); |
61 | | -const options = runCrestodian.mock.calls[0]?.[0] as |
| 61 | +const options = runCrestodian.mock.calls.at(0)?.[0] as |
62 | 62 | | { message?: string; yes?: boolean; json?: boolean } |
63 | 63 | | undefined; |
64 | 64 | expect(options?.message).toBe("status"); |
@@ -69,7 +69,7 @@ describe("cli program (smoke)", () => {
|
69 | 69 | it("warns and ignores invalid tui timeout override", async () => { |
70 | 70 | await runProgram(["tui", "--timeout-ms", "nope"]); |
71 | 71 | expect(runtime.error).toHaveBeenCalledWith('warning: invalid --timeout-ms "nope"; ignoring'); |
72 | | -const options = runTui.mock.calls[0]?.[0] as { timeoutMs?: number } | undefined; |
| 72 | +const options = runTui.mock.calls.at(0)?.[0] as { timeoutMs?: number } | undefined; |
73 | 73 | expect(options?.timeoutMs).toBeUndefined(); |
74 | 74 | }); |
75 | 75 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。