# test.govlab/quality/core/formatters/canon.formatter.test.ts

> 8 lines of code and 0 definitions.

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

Listed in [test.govlab/quality/core/formatters](https://banes-lab.com/api/source/testing/test.govlab/quality/core/formatters.md), before [test.govlab/quality/core/formatters/canon.reference.formatter.test.ts](https://banes-lab.com/source/testing/test.govlab/quality/core/formatters/canon.reference.formatter.test.ts.md).

## Contained in

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

## Source

```typescript
import { expect, test } from "vitest";
import { withCanon } from "@govlab/quality/core/formatters/canon.formatter.ts";

test("withCanon tags the text with the rule id and, when concepts are given, their canon references", () => {
    expect(withCanon("Fix it.", "some_rule", [])).toBe("Fix it. [some_rule]");
    expect(withCanon("Fix it.", "some_rule", ["magic-number"])).toBe(
        "Fix it. [some_rule] [canon: quality:concept:magic-number]",
    );
});
```
