Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 1 | import { test } from "node:test"; |
| 2 | import assert from "node:assert/strict"; | |
| 3 | ||
| 4 | import { effectiveDescription, ownDescription } from "./description.ts"; | |
| 5 | ||
| 6 | test("a project without its own description shows its repository's, as it is now", () => { | |
| 7 | assert.deepEqual(effectiveDescription({ description: null, repo_description: "Git for agents" }), { | |
| 8 | description: "Git for agents", | |
| 9 | inherited: true, | |
| 10 | }); | |
| 11 | assert.deepEqual(effectiveDescription({ description: null, repo_description: null }), { description: null, inherited: true }); | |
| 12 | assert.deepEqual(effectiveDescription({ description: null }), { description: null, inherited: true }); | |
| 13 | }); | |
| 14 | ||
| 15 | test("its own description wins over the repository's", () => { | |
| 16 | assert.deepEqual(effectiveDescription({ description: "The storefront", repo_description: "Monorepo" }), { | |
| 17 | description: "The storefront", | |
| 18 | inherited: false, | |
| 19 | }); | |
| 20 | }); | |
| 21 | ||
| 22 | test("a change sets its own, clears back to the repository's, or leaves it", () => { | |
| 23 | assert.equal(ownDescription("Old", undefined), "Old"); | |
| 24 | assert.equal(ownDescription(null, undefined), null); | |
| 25 | assert.equal(ownDescription("Old", " New "), "New"); | |
| 26 | assert.equal(ownDescription("Old", ""), null); | |
| 27 | assert.equal(ownDescription("Old", " "), null); | |
| 28 | assert.equal(ownDescription("Old", null), null); | |
| 29 | assert.equal(ownDescription(null, "x".repeat(300))?.length, 200); | |
| 30 | }); |