| 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; |
| 3 | |
| 4 | import { distinctFacts } from "./memory-facts.ts"; |
| 5 | |
| 6 | test("a fact remembered twice is shown once, the first kept", () => { |
| 7 | const facts = [ |
| 8 | { id: "a", text: "Run tests with npm test." }, |
| 9 | { id: "b", text: "We use pnpm everywhere" }, |
| 10 | { id: "c", text: "run tests with npm test" }, |
| 11 | { id: "d", text: "We use pnpm everywhere." }, |
| 12 | ]; |
| 13 | assert.deepEqual(distinctFacts(facts).map((fact) => fact.id), ["a", "b"]); |
| 14 | assert.deepEqual(distinctFacts([]), []); |
| 15 | }); |