g1t/services/projects/src/rename.test.ts
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.
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 1 | import { test } from "node:test"; |
| 2 | import assert from "node:assert/strict"; | |
| 3 | ||
| 4 | import { renameStatements } from "./rename.ts"; | |
| 5 | ||
| 6 | test("each statement is bound with as many values as it asks for", () => { | |
| 7 | for (const { sql, params } of renameStatements(["acme", "acme-inc"], "acme-co")) { | |
| 8 | assert.equal(sql.split("?").length - 1, params.length, sql); | |
| 9 | } | |
| 10 | }); | |
| 11 | ||
| 12 | test("only stale slugs move, to the current one", () => { | |
| 13 | const statements = renameStatements(["acme"], "acme-co"); | |
| 14 | assert.ok(statements.length > 0); | |
| 15 | for (const { params } of statements) { | |
| 16 | assert.ok(params.at(-1) === "acme"); | |
| 17 | assert.ok(!params.slice(0, -1).some((value) => value !== "acme-co")); | |
| 18 | } | |
| 19 | assert.deepEqual(renameStatements([], "acme-co"), []); | |
| 20 | }); |