import { describe, expect, it } from "vitest"; import { SOURCE_LIMIT } from "#lib/markup/markdown.ts"; import { renderDocument, renderMarkup } from "#lib/markup/render.ts"; import type { MarkupContext } from "#lib/markup/paths.ts"; const ctx: MarkupContext = { repo: "ada.test/infra", ref: "main", host: "tangled.org" }; describe("renderDocument", () => { it("wraps what it renders", async () => { const html = await renderDocument("README.md", "# hello", ctx); expect(html).toMatch(/^
/); expect(html).toContain(" { expect(await renderDocument("notes.txt", "# hello", ctx)).toBeNull(); }); it("gives up on a document over the source limit", async () => { expect(await renderDocument("README.md", "a".repeat(SOURCE_LIMIT + 1), ctx)).toBeNull(); }); }); describe("renderMarkup", () => { it("renders a body whatever its name", async () => { const html = await renderMarkup("a **body**", ctx); expect(html).toMatch(/^
/); expect(html).toContain("body"); }); });