# test.govlab/docs/core/parsers/diagram.parser.test.ts

> 11 lines of code and 0 definitions.

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

Listed in [test.govlab/docs/core/parsers](https://banes-lab.com/api/source/testing/test.govlab/docs/core/parsers.md), after [test.govlab/docs/core/parsers/code.go.parser.test.ts](https://banes-lab.com/source/testing/test.govlab/docs/core/parsers/code.go.parser.test.ts.md) and before [test.govlab/docs/core/parsers/export.parser.test.ts](https://banes-lab.com/source/testing/test.govlab/docs/core/parsers/export.parser.test.ts.md).

## Contained in

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

## Source

````typescript
import { describe, expect, it } from "vitest";
import { mermaidBlocks } from "@govlab/docs/core/parsers/diagram.parser.ts";

describe("mermaidBlocks", () => {
    it("collects only mermaid fences with the line their body starts on", () => {
        const source = ["# T", "```ts", "const a = 1;", "```", "```mermaid", "flowchart TD", "  A --> B", "```"].join(
            "\n",
        );
        expect(mermaidBlocks(source)).toStrictEqual([{ code: "flowchart TD\n  A --> B", startLine: 6 }]);
        expect(mermaidBlocks("no fences")).toStrictEqual([]);
    });
});
````
