test: guard backup registration mock call · openclaw/openclaw@dc3654b
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -43,10 +43,11 @@ describe("registerBackupCommand", () => {
|
43 | 43 | |
44 | 44 | function expectForwardedOptions(command: typeof backupCreateCommand): Record<string, unknown> { |
45 | 45 | expect(command).toHaveBeenCalledTimes(1); |
46 | | -const [runtimeArg, options] = command.mock.calls[0] as unknown as [ |
47 | | -typeof runtime, |
48 | | -Record<string, unknown>, |
49 | | -]; |
| 46 | +const call = command.mock.calls.at(0); |
| 47 | +if (!call) { |
| 48 | +throw new Error("expected backup command call"); |
| 49 | +} |
| 50 | +const [runtimeArg, options] = call as unknown as [typeof runtime, Record<string, unknown>]; |
50 | 51 | expect(runtimeArg).toBe(runtime); |
51 | 52 | return options; |
52 | 53 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。