test: guard gateway cli mock calls · openclaw/openclaw@c070ea3
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -167,7 +167,8 @@ describe("gateway-cli coverage", () => {
|
167 | 167 | "--json", |
168 | 168 | ]); |
169 | 169 | |
170 | | -const stabilityCall = callGateway.mock.calls[0]?.[0] as |
| 170 | +expect(callGateway).toHaveBeenCalledTimes(1); |
| 171 | +const stabilityCall = callGateway.mock.calls.at(0)?.[0] as |
171 | 172 | | { method?: string; params?: unknown } |
172 | 173 | | undefined; |
173 | 174 | expect(stabilityCall?.method).toBe("diagnostics.stability"); |
@@ -266,7 +267,7 @@ describe("gateway-cli coverage", () => {
|
266 | 267 | ); |
267 | 268 | |
268 | 269 | expect(callGateway).toHaveBeenCalledTimes(1); |
269 | | -const healthCall = callGateway.mock.calls[0]?.[0] as |
| 270 | +const healthCall = callGateway.mock.calls.at(0)?.[0] as |
270 | 271 | | { method?: string; timeoutMs?: number } |
271 | 272 | | undefined; |
272 | 273 | expect(healthCall?.method).toBe("health"); |
@@ -430,7 +431,7 @@ describe("gateway-cli coverage", () => {
|
430 | 431 | await expectGatewayExit(["gateway", "--token", "test-token", "--allow-unconfigured"]); |
431 | 432 | |
432 | 433 | expect(startGatewayServer).toHaveBeenCalledTimes(1); |
433 | | -const startCall = startGatewayServer.mock.calls[0]; |
| 434 | +const startCall = startGatewayServer.mock.calls.at(0); |
434 | 435 | expect(startCall?.[0]).toBe(19001); |
435 | 436 | expect(typeof startCall?.[1]).toBe("object"); |
436 | 437 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。