Download src/signal/format.visual.test.ts from Darochin/openskynet: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/Darochin/openskynet/resolve/main/src/signal/format.visual.test.ts
- Command line
-
hf download hf://Darochin/openskynet/src/signal/format.visual.test.ts
-
curl -L -o format.visual.test.ts https://huggingface.co/Darochin/openskynet/resolve/main/src/signal/format.visual.test.ts
2.17 kB
| 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,}/); | |
| }); | |
| }); | |
| }); | |