test(auto-reply): fix heartbeat typing block reply assertions
This commit is contained in:
@@ -47,9 +47,18 @@ vi.mock("./queue.js", async () => {
|
|||||||
import { runReplyAgent } from "./agent-runner.js";
|
import { runReplyAgent } from "./agent-runner.js";
|
||||||
|
|
||||||
type EmbeddedPiAgentParams = {
|
type EmbeddedPiAgentParams = {
|
||||||
onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => Promise<void> | void;
|
onPartialReply?: (payload: {
|
||||||
onBlockReply?: (payload: { text?: string; mediaUrls?: string[] }) => Promise<void> | void;
|
text?: string;
|
||||||
onToolResult?: (payload: { text?: string; mediaUrls?: string[] }) => Promise<void> | void;
|
mediaUrls?: string[];
|
||||||
|
}) => Promise<void> | void;
|
||||||
|
onBlockReply?: (payload: {
|
||||||
|
text?: string;
|
||||||
|
mediaUrls?: string[];
|
||||||
|
}) => Promise<void> | void;
|
||||||
|
onToolResult?: (payload: {
|
||||||
|
text?: string;
|
||||||
|
mediaUrls?: string[];
|
||||||
|
}) => Promise<void> | void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function createMinimalRun(params?: {
|
function createMinimalRun(params?: {
|
||||||
@@ -277,7 +286,13 @@ describe("runReplyAgent typing (heartbeat)", () => {
|
|||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(typing.startTypingOnText).toHaveBeenCalledWith("chunk");
|
expect(typing.startTypingOnText).toHaveBeenCalledWith("chunk");
|
||||||
expect(onBlockReply).toHaveBeenCalledWith({ text: "chunk", mediaUrls: [] });
|
expect(onBlockReply).toHaveBeenCalled();
|
||||||
|
const [blockPayload, blockOpts] = onBlockReply.mock.calls[0] ?? [];
|
||||||
|
expect(blockPayload).toMatchObject({ text: "chunk", audioAsVoice: false });
|
||||||
|
expect(blockOpts).toMatchObject({
|
||||||
|
abortSignal: expect.any(AbortSignal),
|
||||||
|
timeoutMs: expect.any(Number),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("signals typing on tool results", async () => {
|
it("signals typing on tool results", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user