test: dedupe openresponses mock reads · openclaw/openclaw@e2965b5
steipete
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -162,7 +162,7 @@ function requireSessionKey(value: string | undefined, label: string): string {
|
162 | 162 | } |
163 | 163 | |
164 | 164 | function firstAgentOpts(callIndex = 0): Record<string, unknown> { |
165 | | -const call = agentCommand.mock.calls.at(callIndex); |
| 165 | +const call = agentCommand.mock.calls[callIndex]; |
166 | 166 | if (!call) { |
167 | 167 | throw new Error(`expected agentCommand call #${callIndex + 1}`); |
168 | 168 | } |
@@ -1148,7 +1148,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
1148 | 1148 | input: [{ type: "function_call_output", call_id: "call_1", output: "Sunny, 70F." }], |
1149 | 1149 | }); |
1150 | 1150 | expect(secondResponse.status).toBe(200); |
1151 | | -const secondOpts = agentCommand.mock.calls.at(1)?.[0] as { sessionKey?: string } | undefined; |
| 1151 | +const secondOpts = firstAgentOpts(1) as { sessionKey?: string } | undefined; |
1152 | 1152 | expect(secondOpts?.sessionKey).toBe(firstSessionKey); |
1153 | 1153 | await ensureResponseConsumed(secondResponse); |
1154 | 1154 | }); |
@@ -1183,7 +1183,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
1183 | 1183 | input: "hello again", |
1184 | 1184 | }); |
1185 | 1185 | expect(secondResponse.status).toBe(200); |
1186 | | -const secondOpts = agentCommand.mock.calls.at(1)?.[0] as { sessionKey?: string } | undefined; |
| 1186 | +const secondOpts = firstAgentOpts(1) as { sessionKey?: string } | undefined; |
1187 | 1187 | expect(secondOpts?.sessionKey).toBe(firstOpts?.sessionKey); |
1188 | 1188 | await ensureResponseConsumed(secondResponse); |
1189 | 1189 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。