mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 18:24:47 +00:00
test: tighten core mock call helpers
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user