test: guard subagent mock calls · openclaw/openclaw@48576e7
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -234,7 +234,7 @@ describe("subagent-announce-queue", () => {
|
234 | 234 | parentBusy = false; |
235 | 235 | await vi.advanceTimersByTimeAsync(250); |
236 | 236 | expect(send).toHaveBeenCalledTimes(1); |
237 | | -expect(send.mock.calls[0]?.[0]?.prompt).toBe("child completed"); |
| 237 | +expect(send.mock.calls.at(0)?.[0]?.prompt).toBe("child completed"); |
238 | 238 | }); |
239 | 239 | |
240 | 240 | it("preserves an existing defer hook when the same queue is reused without one", async () => { |
@@ -328,7 +328,7 @@ describe("subagent-announce-queue", () => {
|
328 | 328 | |
329 | 329 | await vi.advanceTimersByTimeAsync(1); |
330 | 330 | expect(send).toHaveBeenCalledTimes(1); |
331 | | -expect(send.mock.calls[0]?.[0]?.prompt).toBe("child completed after stale busy state"); |
| 331 | +expect(send.mock.calls.at(0)?.[0]?.prompt).toBe("child completed after stale busy state"); |
332 | 332 | }); |
333 | 333 | |
334 | 334 | it("uses debounce floor for retries when debounce exceeds backoff", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -215,7 +215,7 @@ describe("spawnSubagentDirect seam flow", () => {
|
215 | 215 | const childSessionKey = result.childSessionKey as string; |
216 | 216 | expect(hoisted.pruneLegacyStoreKeysMock).toHaveBeenCalledTimes(3); |
217 | 217 | expect(hoisted.updateSessionStoreMock).toHaveBeenCalledTimes(3); |
218 | | -const registerInput = requireRecord(hoisted.registerSubagentRunMock.mock.calls[0]?.[0]); |
| 218 | +const registerInput = requireRecord(hoisted.registerSubagentRunMock.mock.calls.at(0)?.[0]); |
219 | 219 | const requesterOrigin = requireRecord(registerInput.requesterOrigin); |
220 | 220 | expect(registerInput.runId).toBe("run-1"); |
221 | 221 | expect(registerInput.childSessionKey).toBe(childSessionKey); |
@@ -281,7 +281,7 @@ describe("spawnSubagentDirect seam flow", () => {
|
281 | 281 | ); |
282 | 282 | |
283 | 283 | expect(result.status).toBe("accepted"); |
284 | | -const registerInput = requireRecord(hoisted.registerSubagentRunMock.mock.calls[0]?.[0]); |
| 284 | +const registerInput = requireRecord(hoisted.registerSubagentRunMock.mock.calls.at(0)?.[0]); |
285 | 285 | const requesterOrigin = requireRecord(registerInput.requesterOrigin); |
286 | 286 | expect(requesterOrigin.channel).toBe("discord"); |
287 | 287 | expect(requesterOrigin.accountId).toBe("acct-1"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -161,7 +161,7 @@ describe("spawnSubagentDirect thread binding delivery", () => {
|
161 | 161 | expect(agentCall?.params?.to).toBe(`room:${boundRoom}`); |
162 | 162 | expect(agentCall?.params?.threadId).toBe("$thread-root"); |
163 | 163 | expect(agentCall?.params?.deliver).toBe(true); |
164 | | -const registeredRun = hoisted.registerSubagentRunMock.mock.calls[0]?.[0] as |
| 164 | +const registeredRun = hoisted.registerSubagentRunMock.mock.calls.at(0)?.[0] as |
165 | 165 | | { |
166 | 166 | requesterOrigin?: { channel?: string; accountId?: string; to?: string }; |
167 | 167 | expectsCompletionMessage?: boolean; |
@@ -222,7 +222,7 @@ describe("spawnSubagentDirect thread binding delivery", () => {
|
222 | 222 | expect(agentCall?.params?.accountId).toBe("sut"); |
223 | 223 | expect(agentCall?.params?.to).toBe("room:!parent:example"); |
224 | 224 | expect(agentCall?.params?.deliver).toBe(false); |
225 | | -const registeredRun = hoisted.registerSubagentRunMock.mock.calls[0]?.[0] as |
| 225 | +const registeredRun = hoisted.registerSubagentRunMock.mock.calls.at(0)?.[0] as |
226 | 226 | | { |
227 | 227 | requesterOrigin?: { channel?: string; accountId?: string; to?: string }; |
228 | 228 | expectsCompletionMessage?: boolean; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。