test: guard status registration mock call · openclaw/openclaw@bf71a89
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -59,7 +59,11 @@ function requireRecord(value: unknown, label: string): Record<string, unknown> {
|
59 | 59 | |
60 | 60 | function expectCommandOptions(command: MockCalls, expected: Record<string, unknown>) { |
61 | 61 | expect(command.mock.calls).toHaveLength(1); |
62 | | -const [options, actualRuntime] = command.mock.calls[0] ?? []; |
| 62 | +const call = command.mock.calls.at(0); |
| 63 | +if (!call) { |
| 64 | +throw new Error("expected command call"); |
| 65 | +} |
| 66 | +const [options, actualRuntime] = call; |
63 | 67 | expect(actualRuntime).toBe(runtime); |
64 | 68 | const optionsRecord = requireRecord(options, "command options"); |
65 | 69 | for (const [key, value] of Object.entries(expected)) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。