Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2import { splitBufferedAssistantText } from "./assistantStreaming.ts";
3
4describe("V2 assistant streaming", () => {
5 it("keeps code fences intact", () => {
6 expect(splitBufferedAssistantText("Intro\n\n```ts\nx()\n\n")).toEqual({
7 ready: "Intro\n\n",
8 rest: "```ts\nx()\n\n",
9 });
10 expect(splitBufferedAssistantText("```ts\nx()\n```\nrest")).toEqual({
11 ready: "```ts\nx()\n```\n",
12 rest: "rest",
13 });
14 });
15});
16
17it("holds a streamed section heading until its content has a boundary", () => {
18 expect(splitBufferedAssistantText("Intro\n\n## Results\n\n")).toEqual({
19 ready: "Intro\n\n",
20 rest: "## Results\n\n",
21 });
22 expect(splitBufferedAssistantText("**Results**\n\nBody\n\nNext")).toEqual({
23 ready: "**Results**\n\nBody\n\n",
24 rest: "Next",
25 });
26});