| 1 | import { test } from "node:test"; |
| 2 | import assert from "node:assert/strict"; |
| 3 | |
| 4 | import { ownDescription } from "./description.ts"; |
| 5 | |
| 6 | test("a change sets the description, clears it, or leaves it", () => { |
| 7 | assert.equal(ownDescription("Old", undefined), "Old"); |
| 8 | assert.equal(ownDescription(null, undefined), null); |
| 9 | assert.equal(ownDescription("Old", " New "), "New"); |
| 10 | assert.equal(ownDescription("Old", ""), null); |
| 11 | assert.equal(ownDescription("Old", " "), null); |
| 12 | assert.equal(ownDescription("Old", null), null); |
| 13 | assert.equal(ownDescription(null, "x".repeat(300))?.length, 200); |
| 14 | }); |