test: guard acp lifecycle mock calls · openclaw/openclaw@24f23cf
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -99,12 +99,20 @@ function mockReadySession(params: {
|
99 | 99 | |
100 | 100 | function expectCloseArgs(): Record<string, unknown> { |
101 | 101 | expect(managerMocks.closeSession).toHaveBeenCalledTimes(1); |
102 | | -return (managerMocks.closeSession.mock.calls[0] as unknown as [Record<string, unknown>])[0]; |
| 102 | +const call = managerMocks.closeSession.mock.calls.at(0); |
| 103 | +if (!call) { |
| 104 | +throw new Error("expected closeSession call"); |
| 105 | +} |
| 106 | +return call[0] as Record<string, unknown>; |
103 | 107 | } |
104 | 108 | |
105 | 109 | function expectInitializeArgs(): Record<string, unknown> { |
106 | 110 | expect(managerMocks.initializeSession).toHaveBeenCalledTimes(1); |
107 | | -return (managerMocks.initializeSession.mock.calls[0] as unknown as [Record<string, unknown>])[0]; |
| 111 | +const call = managerMocks.initializeSession.mock.calls.at(0); |
| 112 | +if (!call) { |
| 113 | +throw new Error("expected initializeSession call"); |
| 114 | +} |
| 115 | +return call[0] as Record<string, unknown>; |
108 | 116 | } |
109 | 117 | |
110 | 118 | describe("ensureConfiguredAcpBindingSession", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。