import { describe, expect, it } from "vitest"; import { extractAssistantText, sanitizeTextContent } from "./sessions-helpers.js"; describe("sanitizeTextContent", () => { it("strips minimax tool call XML and downgraded markers", () => { const input = 'Hello payload ' + "[Tool Call: foo (ID: 1)] world"; const result = sanitizeTextContent(input).trim(); expect(result).toBe("Hello world"); expect(result).not.toContain("invoke"); expect(result).not.toContain("Tool Call"); }); it("strips thinking tags", () => { const input = "Before secret after"; const result = sanitizeTextContent(input).trim(); expect(result).toBe("Before after"); }); }); describe("extractAssistantText", () => { it("sanitizes blocks without injecting newlines", () => { const message = { role: "assistant", content: [ { type: "text", text: "Hi " }, { type: "text", text: "secretthere" }, ], }; expect(extractAssistantText(message)).toBe("Hi there"); }); });