From 21fe98a77cbd15d6937d3b93cd507bef1c8dc27c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 12 May 2026 06:01:12 +0100 Subject: [PATCH] test: tighten core mock call helpers --- src/agents/subagent-announce.format.e2e.test.ts | 9 +++++++-- src/cron/isolated-agent/run.owner-auth.test.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/agents/subagent-announce.format.e2e.test.ts b/src/agents/subagent-announce.format.e2e.test.ts index 8224e0e3ec8..d2ecf5e64b6 100644 --- a/src/agents/subagent-announce.format.e2e.test.ts +++ b/src/agents/subagent-announce.format.e2e.test.ts @@ -26,7 +26,12 @@ import { runSubagentAnnounceDispatch } from "./subagent-announce-dispatch.js"; import { resetAnnounceQueuesForTests } from "./subagent-announce-queue.js"; import * as agentStep from "./tools/agent-step.js"; -type AgentCallRequest = { method?: string; params?: Record }; +type AgentCallRequest = { + method?: string; + params?: Record & { + internalEvents?: Array<{ type?: string; taskLabel?: string }>; + }; +}; type RequesterResolution = { requesterSessionKey: string; requesterOrigin?: Record; @@ -84,7 +89,7 @@ function expectInputProvenance( } function getAgentCall(index = 0): AgentCallRequest { - const call = agentSpy.mock.calls[index]?.[0]; + const call = agentSpy.mock.calls.at(index)?.[0]; if (!call) { throw new Error(`Expected agent call at index ${index}`); } diff --git a/src/cron/isolated-agent/run.owner-auth.test.ts b/src/cron/isolated-agent/run.owner-auth.test.ts index 1f97218c495..6e162752f77 100644 --- a/src/cron/isolated-agent/run.owner-auth.test.ts +++ b/src/cron/isolated-agent/run.owner-auth.test.ts @@ -51,7 +51,7 @@ function requireEmbeddedAgentCall(): { ownerOnlyToolAllowlist?: string[]; toolsAllow?: string[]; } { - const call = runEmbeddedPiAgentMock.mock.calls[0]?.[0] as + const call = runEmbeddedPiAgentMock.mock.calls.at(0)?.[0] as | { senderIsOwner?: boolean; jobId?: string;