# test.govlab/docs/core/formatters/markdown.formatter.test.ts

> 35 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-docs-core-formatters-markdown-formatter-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/docs/core/formatters/markdown.formatter.test.ts.txt

Listed in [test.govlab/docs/core/formatters](https://banes-lab.com/api/source/testing/test.govlab/docs/core/formatters.md), after [test.govlab/docs/core/formatters/index.formatter.test.ts](https://banes-lab.com/source/testing/test.govlab/docs/core/formatters/index.formatter.test.ts.md) and before [test.govlab/docs/core/formatters/readme.fixture.ts](https://banes-lab.com/source/testing/test.govlab/docs/core/formatters/readme.fixture.ts.md).

## Contained in

- [test.govlab/docs/core/formatters](https://banes-lab.com/anatomy/testing/folder-testing-test-govlab-docs-core-formatters.md)

## Source

````typescript
import {
    bullets,
    renderConfiguration,
    renderFieldFragment,
    renderQuickStart,
    renderRenderable,
    titleCase,
} from "@govlab/docs/core/formatters/markdown.formatter.ts";
import { describe, expect, it } from "vitest";

describe("titleCase and bullets", () => {
    it("turn a kebab id into a heading and items into a list", () => {
        expect(titleCase("quality-governance")).toBe("Quality Governance");
        expect(bullets(["a", "b"])).toBe("- a\n- b");
    });
});

describe("renderRenderable", () => {
    it("renders a string, a string list and record arrays, and nothing for other shapes", () => {
        expect(renderRenderable("plain")).toBe("plain");
        expect(renderRenderable(["a", "b"])).toBe("- a\n- b");
        expect(renderRenderable([{ k: "v" }])).toBe("- **k**: v");
        expect(renderRenderable({})).toBe("");
    });
});

describe("the field renderers", () => {
    it("render quick-start blocks, configuration options and api notes", () => {
        expect(renderQuickStart([{ code: "run()", intent: "Run", lang: "ts" }])).toContain("```ts");
        expect(renderConfiguration([{ default: "3", note: "depth", option: "max" }])).toBe(
            "- `max` (default: `3`) — depth",
        );
        expect(renderConfiguration([{ note: "both", option: "a.one, a.two" }])).toBe("- `a.one` and `a.two` — both");
        expect(renderConfiguration([{ option: "a, b, c" }])).toBe("- `a`, `b` and `c`");
        expect(renderFieldFragment("apiNotes", [{ name: "x", note: "a note" }])).toBe("a note");
        expect(renderFieldFragment("overview", "text")).toBe("text");
    });
});
````
