public
anord
read
Ledger
Why work hard when you can work easier?
Languages
Repository composition by tracked source files.
TypeScript
86%
CSS
10%
SQL
3%
Shell
1%
HTML
0%
Trace
apps/api/src/test/markdown.test.ts
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
import { describe, expect, it } from "vitest";
2
import { renderMarkdown } from "../utils/markdown.js";
4
describe("markdown rendering", () => {
5
it("sanitizes unsafe html", () => {
6
const rendered = renderMarkdown("# Hello\n\n<script>alert('xss')</script><b>safe</b>");
7
expect(rendered.bodyHtml).not.toContain("<script>");
8
expect(rendered.bodyHtml).toContain("<b>safe</b>");
9
});
11
it("builds a table of contents from headings", () => {
12
const rendered = renderMarkdown("# One\n\n## Two");
13
expect(rendered.toc).toEqual([
14
{ id: "one", text: "One", level: 1 },
15
{ id: "two", text: "Two", level: 2 }
16
]);
17
});
18
});