File size: 2,172 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { describe, expect, it } from "vitest";
import { markdownToSignalText } from "./format.js";

describe("markdownToSignalText", () => {
  describe("headings visual distinction", () => {
    it("renders headings as bold text", () => {
      const res = markdownToSignalText("# Heading 1");
      expect(res.text).toBe("Heading 1");
      expect(res.styles).toContainEqual({ start: 0, length: 9, style: "BOLD" });
    });

    it("renders h2 headings as bold text", () => {
      const res = markdownToSignalText("## Heading 2");
      expect(res.text).toBe("Heading 2");
      expect(res.styles).toContainEqual({ start: 0, length: 9, style: "BOLD" });
    });

    it("renders h3 headings as bold text", () => {
      const res = markdownToSignalText("### Heading 3");
      expect(res.text).toBe("Heading 3");
      expect(res.styles).toContainEqual({ start: 0, length: 9, style: "BOLD" });
    });
  });

  describe("blockquote visual distinction", () => {
    it("renders blockquotes with a visible prefix", () => {
      const res = markdownToSignalText("> This is a quote");
      // Should have some kind of prefix to distinguish it
      expect(res.text).toMatch(/^[β”‚>]/);
      expect(res.text).toContain("This is a quote");
    });

    it("renders multi-line blockquotes with prefix", () => {
      const res = markdownToSignalText("> Line 1\n> Line 2");
      // Should start with the prefix
      expect(res.text).toMatch(/^[β”‚>]/);
      expect(res.text).toContain("Line 1");
      expect(res.text).toContain("Line 2");
    });
  });

  describe("horizontal rule rendering", () => {
    it("renders horizontal rules as a visible separator", () => {
      const res = markdownToSignalText("Para 1\n\n---\n\nPara 2");
      // Should contain some kind of visual separator like ───
      expect(res.text).toMatch(/[─—-]{3,}/);
    });

    it("renders horizontal rule between content", () => {
      const res = markdownToSignalText("Above\n\n***\n\nBelow");
      expect(res.text).toContain("Above");
      expect(res.text).toContain("Below");
      // Should have a separator
      expect(res.text).toMatch(/[─—-]{3,}/);
    });
  });
});