test: guard command prompt call helpers · openclaw/openclaw@e25283f
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -47,14 +47,18 @@ function selectArg(index = 0): {
|
47 | 47 | options?: Array<{ value: unknown; label: string }>; |
48 | 48 | } { |
49 | 49 | const call = select.mock.calls[index]; |
50 | | -expect(call).toBeDefined(); |
51 | | -return call?.[0] as { message?: string; options?: Array<{ value: unknown; label: string }> }; |
| 50 | +if (!call) { |
| 51 | +throw new Error(`Expected select call ${index}`); |
| 52 | +} |
| 53 | +return call[0] as { message?: string; options?: Array<{ value: unknown; label: string }> }; |
52 | 54 | } |
53 | 55 | |
54 | 56 | function confirmArg(index = 0): { message?: string } { |
55 | 57 | const call = confirm.mock.calls[index]; |
56 | | -expect(call).toBeDefined(); |
57 | | -return call?.[0] as { message?: string }; |
| 58 | +if (!call) { |
| 59 | +throw new Error(`Expected confirm call ${index}`); |
| 60 | +} |
| 61 | +return call[0] as { message?: string }; |
58 | 62 | } |
59 | 63 | |
60 | 64 | function expectOption( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。