Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132import { 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(/^<div data-markup>/); expect(html).toContain("<h1"); expect(html).toContain("hello"); });
it("keeps a document that is not markdown away from the renderer", async () => { 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(/^<div data-markup>/); expect(html).toContain("<strong>body</strong>"); });});