test(agents): add malformed MEDIA prose integration coverage

Co-authored-by: Ho Lim <166576253+HOYALIM@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-02-22 19:59:03 +01:00
parent c3d11d56c3
commit 8eb71cec26

View File

@@ -208,6 +208,28 @@ describe("handleToolExecutionEnd media emission", () => {
expect(onToolResult).not.toHaveBeenCalled();
});
it("does NOT emit media for malformed MEDIA:-prefixed prose", async () => {
const onToolResult = vi.fn();
const ctx = createMockContext({ shouldEmitToolOutput: false, onToolResult });
await handleToolExecutionEnd(ctx, {
type: "tool_execution_end",
toolName: "browser",
toolCallId: "tc-1",
isError: false,
result: {
content: [
{
type: "text",
text: "MEDIA:-prefixed paths (lenient whitespace) when loading outbound media",
},
],
},
});
expect(onToolResult).not.toHaveBeenCalled();
});
it("emits media from details.path fallback when no MEDIA: text", async () => {
const onToolResult = vi.fn();
const ctx = createMockContext({ shouldEmitToolOutput: false, onToolResult });