syntaxai/tdd.md · main · src / b51_render_docs_layout.test.ts

b51_render_docs_layout.test.ts 29 lines · 1072 bytes raw
// Sibling test for c51_render_docs_layout.ts (Layer 1, render). The
// docs chrome wraps markdown content with sidebar + on-this-page +
// edit-link blocks. End-to-end coverage is in editor-flow.spec.ts
// (which asserts .docs-content presence on /sama).

import { describe, test, expect } from "bun:test";
import { renderDocsPage } from "./b51_render_docs_layout.ts";

describe("c51_render_docs_layout — renderDocsPage", () => {
  test("is an async function", () => {
    expect(typeof renderDocsPage).toBe("function");
  });

  test("renders a complete HTML document for a minimal options object", async () => {
    const html = await renderDocsPage({
      title: "Test page",
      description: "Test description",
      bodyMarkdown: "# Hello\n\nThis is a docs page.\n",
      ogPath: "https://tdd.md/test",
      active: "home",
      pathForDocs: "/test",
    });
    expect(html).toContain("<!doctype html>");
    expect(html).toContain("<title>Test page");
    expect(html).toContain("docs-content");
    expect(html).toContain("This is a docs page");
  });
});