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"), []); }); });