test(agents): centralize AgentMessage fixtures and remove unsafe casts

This commit is contained in:
Peter Steinberger
2026-03-03 02:13:43 +00:00
parent 15a0455d04
commit 70db52de71
14 changed files with 216 additions and 139 deletions

View File

@@ -2,13 +2,14 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core";
import { SessionManager } from "@mariozechner/pi-coding-agent";
import { describe, expect, it, vi } from "vitest";
import { applyGoogleTurnOrderingFix } from "./pi-embedded-runner.js";
import { castAgentMessage } from "./test-helpers/agent-message-fixtures.js";
describe("applyGoogleTurnOrderingFix", () => {
const makeAssistantFirst = (): AgentMessage[] => [
{
castAgentMessage({
role: "assistant",
content: [{ type: "toolCall", id: "call_1", name: "exec", arguments: {} }],
} as unknown as AgentMessage,
}),
];
it("prepends a bootstrap once and records a marker for Google models", () => {