flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/services/projects/src/rename.test.ts

20 lines734 bytesCodeBlame

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 domains1import { test } from "node:test";
2import assert from "node:assert/strict";
3
4import { renameStatements } from "./rename.ts";
5
6test("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
12test("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});