Skip to content

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.sh
29 linesCodeBlameRaw
1import { test } from "node:test";
2import assert from "node:assert/strict";
3
4import { shownCard } from "./cards.ts";
5
6test("an old card keeps its links and drops actions nobody answers any more", () => {
7 const card = shownCard({
8 kind: "session",
9 title: "Fix the login",
10 detail: null,
11 state: "working",
12 href: "/acme/web/pull/1",
13 owner: "agents",
14 ref: "ses_1",
15 actions: [
16 { id: "approve", label: "Approve more", style: "primary", confirm: null, input: null, href: null },
17 { id: "open", label: "Open", style: "default", confirm: null, input: null, href: "/acme/web/pull/1" },
18 ],
19 });
20 assert.equal(card.owner, undefined);
21 assert.equal(card.ref, undefined);
22 assert.deepEqual(card.actions?.map((a) => a.id), ["open"]);
23});
24
25test("a card with nothing left to press has no actions", () => {
26 const card = shownCard({ kind: "x", title: "x", detail: null, state: null, href: null, owner: "agents", actions: [{ id: "stop", label: "Stop", style: "danger", confirm: null, input: null, href: null }] });
27 assert.equal("actions" in card, false);
28 assert.deepEqual(shownCard({ kind: "x", title: "x", detail: null, state: null, href: null }), { kind: "x", title: "x", detail: null, state: null, href: null });
29});