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.
| Merge branch 'worktree-agent-aaf03bdceac799c89' | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| Repository files and avatars on g1tusercontent.com: raw files, a Raw button, images on file pages and in READMEs | 4 | import { HOSTED_ADDRESSES, addressesFor, addressesFrom, cloneUrl, usercontentFrom } from "./addresses.ts"; |
| Merge branch 'worktree-agent-aaf03bdceac799c89' | 5 | import { MCP_URL } from "./agent-setup.ts"; |
| 6 | import { OG, SITE } from "./meta.ts"; | |
| 7 | ||
| 8 | test("with no settings, the addresses are g1t.sh's", () => { | |
| 9 | assert.deepEqual(addressesFor({}), HOSTED_ADDRESSES); | |
| 10 | assert.deepEqual(addressesFor({ SITE_URL: "", API_URL: "", MCP_URL: "" }), HOSTED_ADDRESSES); | |
| 11 | }); | |
| 12 | ||
| 13 | test("settings replace the addresses, without trailing slashes", () => { | |
| 14 | assert.deepEqual( | |
| 15 | addressesFor({ | |
| 16 | SITE_URL: "http://localhost:8787/", | |
| 17 | API_URL: "http://localhost:8788", | |
| 18 | MCP_URL: "http://localhost:8790/mcp/", | |
| 19 | OG_URL: "", | |
| 20 | }), | |
| Repository files and avatars on g1tusercontent.com: raw files, a Raw button, images on file pages and in READMEs | 21 | { |
| 22 | site: "http://localhost:8787", | |
| 23 | api: "http://localhost:8788", | |
| 24 | mcp: "http://localhost:8790/mcp", | |
| 25 | og: null, | |
| 26 | usercontent: "http://localhost:8787/-/usercontent", | |
| 27 | }, | |
| Merge branch 'worktree-agent-aaf03bdceac799c89' | 28 | ); |
| 29 | }); | |
| 30 | ||
| Repository files and avatars on g1tusercontent.com: raw files, a Raw button, images on file pages and in READMEs | 31 | test("files people supply are served from an origin of their own", () => { |
| 32 | assert.equal(addressesFor({}).usercontent, "https://g1tusercontent.com"); | |
| 33 | assert.equal(addressesFor({ SITE_URL: "https://git.example.com", USERCONTENT_URL: "https://files.example.net/" }).usercontent, "https://files.example.net"); | |
| 34 | assert.equal(addressesFor({ SITE_URL: "https://git.example.com", USERCONTENT_URL: "https://git.example.com" }).usercontent, "https://git.example.com/-/usercontent"); | |
| 35 | assert.equal(usercontentFrom(undefined), ""); | |
| 36 | assert.equal(usercontentFrom({ addresses: HOSTED_ADDRESSES }), "https://g1tusercontent.com"); | |
| 37 | }); | |
| 38 | ||
| Merge branch 'worktree-agent-aaf03bdceac799c89' | 39 | test("pages without root data use g1t.sh's addresses", () => { |
| 40 | assert.deepEqual(addressesFrom(undefined), HOSTED_ADDRESSES); | |
| 41 | const own = { site: "http://localhost:8787", api: "a", mcp: "m", og: null }; | |
| 42 | assert.deepEqual(addressesFrom({ addresses: own }), own); | |
| 43 | }); | |
| 44 | ||
| 45 | test("the defaults kept in meta and agent setup are g1t.sh's", () => { | |
| 46 | assert.equal(SITE, HOSTED_ADDRESSES.site); | |
| 47 | assert.equal(OG, HOSTED_ADDRESSES.og); | |
| 48 | assert.equal(MCP_URL, HOSTED_ADDRESSES.mcp); | |
| 49 | }); | |
| 50 | ||
| 51 | test("a clone address is under the site", () => { | |
| 52 | assert.equal(cloneUrl(HOSTED_ADDRESSES, "acme/web"), "https://g1t.sh/acme/web.git"); | |
| 53 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.