test: guard models cli mock calls · openclaw/openclaw@131c415
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -111,10 +111,10 @@ describe("models cli", () => {
|
111 | 111 | expected: Record<string, unknown>, |
112 | 112 | ) { |
113 | 113 | expect(command).toHaveBeenCalledTimes(1); |
114 | | -const options = command.mock.calls[0]?.[0] as Record<string, unknown> | undefined; |
115 | | -const context = command.mock.calls[0]?.[1]; |
| 114 | +const [options, context] = command.mock.calls.at(0) ?? []; |
| 115 | +const optionRecord = options as Record<string, unknown> | undefined; |
116 | 116 | for (const [key, value] of Object.entries(expected)) { |
117 | | -expect(options?.[key]).toEqual(value); |
| 117 | +expect(optionRecord?.[key]).toEqual(value); |
118 | 118 | } |
119 | 119 | if (!context || typeof context !== "object") { |
120 | 120 | throw new Error("expected command context"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。