test: guard acpx runtime mock calls · openclaw/openclaw@e5a674a
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -111,7 +111,11 @@ function makeLeaseStore() {
|
111 | 111 | function readFirstEnsureSessionInput(ensure: { |
112 | 112 | mock: { calls: Array<Array<unknown>> }; |
113 | 113 | }): Parameters<AcpRuntime["ensureSession"]>[0] { |
114 | | -const input = ensure.mock.calls[0]?.[0]; |
| 114 | +const [call] = ensure.mock.calls; |
| 115 | +if (!call) { |
| 116 | +throw new Error("Expected ensureSession to be called"); |
| 117 | +} |
| 118 | +const [input] = call; |
115 | 119 | if (typeof input !== "object" || input === null) { |
116 | 120 | throw new Error("Expected ensureSession to be called with an input object"); |
117 | 121 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -157,7 +157,11 @@ function createMockRuntime(overrides: Record<string, unknown> = {}) {
|
157 | 157 | } |
158 | 158 | |
159 | 159 | function readFirstRuntimeFactoryInput(runtimeFactory: { mock: { calls: Array<Array<unknown>> } }) { |
160 | | -const input = runtimeFactory.mock.calls[0]?.[0]; |
| 160 | +const [call] = runtimeFactory.mock.calls; |
| 161 | +if (!call) { |
| 162 | +throw new Error("Expected runtimeFactory to be called"); |
| 163 | +} |
| 164 | +const [input] = call; |
161 | 165 | if (typeof input !== "object" || input === null) { |
162 | 166 | throw new Error("Expected runtimeFactory to be called with an options object"); |
163 | 167 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。