test: tighten core mock call helpers

This commit is contained in:
Peter Steinberger
2026-05-12 06:01:12 +01:00
parent c860104b22
commit 21fe98a77c
2 changed files with 8 additions and 3 deletions

View File

@@ -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<string, unknown> };
type AgentCallRequest = {
method?: string;
params?: Record<string, unknown> & {
internalEvents?: Array<{ type?: string; taskLabel?: string }>;
};
};
type RequesterResolution = {
requesterSessionKey: string;
requesterOrigin?: Record<string, unknown>;
@@ -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}`);
}

View File

@@ -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;