Elffuss BraidHub

kikocis/continue public

main · 1.2 KiBRawPermalink
1import { render } from "ink-testing-library";
2import React from "react";
3
4import { MarkdownRenderer } from "./MarkdownRenderer.js";
5
6describe("MarkdownRenderer - thinking tags", () => {
7 it("handles multiple thinking tags", () => {
8 const content =
9 "Text <think>First thought</think> middle <think>Second thought</think> end";
10 const { lastFrame } = render(<MarkdownRenderer content={content} />);
11
12 expect(lastFrame()).toContain("First thought");
13 expect(lastFrame()).toContain("Second thought");
14 });
15
16 it("handles thinking tags with multiline content", () => {
17 const content = `<think>
18 This is a multiline
19 thinking block
20 </think>`;
21 const { lastFrame } = render(<MarkdownRenderer content={content} />);
22
23 expect(lastFrame()).toContain("This is a multiline");
24 expect(lastFrame()).toContain("thinking block");
25 });
26
27 it("ignores thinking tags inside code blocks", () => {
28 const content = "```\n<think>This should not be processed</think>\n```";
29 const { lastFrame } = render(<MarkdownRenderer content={content} />);
30
31 // The thinking tag should appear as literal text within the code block
32 expect(lastFrame()).toContain(
33 "<think>This should not be processed</think>",
34 );
35 });
36});