diff --git a/src/agents/pi-embedded-utils.test.ts b/src/agents/pi-embedded-utils.test.ts index ca919a39631..6a5ce710c85 100644 --- a/src/agents/pi-embedded-utils.test.ts +++ b/src/agents/pi-embedded-utils.test.ts @@ -553,7 +553,9 @@ describe("stripDowngradedToolCallText", () => { describe("promoteThinkingTagsToBlocks", () => { it("does not crash on malformed null content entries", () => { const msg = makeAssistantMessage({ + role: "assistant", content: [null as never, { type: "text", text: "hellook" }], + timestamp: Date.now(), }); expect(() => promoteThinkingTagsToBlocks(msg)).not.toThrow(); const types = msg.content.map((b: { type?: string }) => b?.type); @@ -563,14 +565,18 @@ describe("promoteThinkingTagsToBlocks", () => { it("does not crash on undefined content entries", () => { const msg = makeAssistantMessage({ + role: "assistant", content: [undefined as never, { type: "text", text: "no tags here" }], + timestamp: Date.now(), }); expect(() => promoteThinkingTagsToBlocks(msg)).not.toThrow(); }); it("passes through well-formed content unchanged when no thinking tags", () => { const msg = makeAssistantMessage({ + role: "assistant", content: [{ type: "text", text: "hello world" }], + timestamp: Date.now(), }); promoteThinkingTagsToBlocks(msg); expect(msg.content).toEqual([{ type: "text", text: "hello world" }]);