# tests/core/formatters/text.formatter.test.ts

> 18 lines of code and 0 definitions.

Tree: Coordination tree
Language: typescript
Canonical: https://banes-lab.com/anatomy/coordination#file-coordination-tests-core-formatters-text-formatter-test-ts
Source text: https://banes-lab.com/assets/sources/source.d372b319e1de3f331d71997bab64d1b6016b2e0a0220cc6380856ee7b4514f72.generated.txt

## Source

```typescript
import { describe, it } from "node:test";
import { diffLines, safeKey } from "../../../tools/core/formatters/text.formatter.ts";
import assert from "node:assert/strict";

describe("safeKey", () => {
    it("keeps letters and digits and spells every other character as a hyphen", () => {
        assert.equal(safeKey("collab.comms/A_1"), "collab-comms-A-1");
    });
});

describe("diffLines", () => {
    it("lists removed lines, then added lines, counting repeated lines and ignoring blank ones", () => {
        const before = "keep\nold\nrepeat\nrepeat\n\n";
        const after = "keep\nnew\nrepeat\n\n\n";
        assert.deepEqual(diffLines(before, after), ["- old", "- repeat", "+ new"]);
    });

    it("reports nothing when the texts hold the same lines", () => {
        assert.deepEqual(diffLines("a\nb", "a\nb"), []);
    });
});
```
