# test.govlab/stats/core/reporters/report.reporter.test.ts

> 26 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-stats-core-reporters-report-reporter-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/stats/core/reporters/report.reporter.test.ts.txt

Listed in [test.govlab/stats/core/reporters](https://banes-lab.com/api/source/testing/test.govlab/stats/core/reporters.md), after [test.govlab/stats/core/reporters/metric.reporter.test.ts](https://banes-lab.com/source/testing/test.govlab/stats/core/reporters/metric.reporter.test.ts.md) and before [test.govlab/stats/core/reporters/site.reporter.test.ts](https://banes-lab.com/source/testing/test.govlab/stats/core/reporters/site.reporter.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { GENERATED_MARK_PREFIX } from "@govlab/canonical-write";
import { INPUT } from "../loaders/stats.fixture.ts";
import { renderReport } from "@govlab/stats/core/reporters/report.reporter.ts";

describe("renderReport", () => {
    const markdown = renderReport(INPUT);

    it("opens with frontmatter, so the document validator can read its axes", () => {
        expect(markdown.startsWith("---\n")).toBe(true);
        expect(markdown).toContain("name: codebase-stats");
    });

    it("leaves the generated mark to the writer, so an unchanged census keeps its time and version", () => {
        expect(markdown).not.toContain(GENERATED_MARK_PREFIX);
    });

    it("renders every section in order", () => {
        const order = [
            "## I. Existence",
            "## II. Arrangement",
            "## III. Dynamics",
            "## IV. Interaction",
            "## V. Abstraction",
        ];
        const positions = order.map((heading) => markdown.indexOf(heading));
        expect(positions.every((at) => at >= 0)).toBe(true);
        expect(positions).toStrictEqual(positions.toSorted((a, b) => a - b));
    });
});
```
