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.

46 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(
23 card.actions?.map((a) => a.id),
24 ["open"],
25 );
26});
27
28test("a card with nothing left to press has no actions", () => {
29 const card = shownCard({
30 kind: "x",
31 title: "x",
32 detail: null,
33 state: null,
34 href: null,
35 owner: "agents",
36 actions: [{ id: "stop", label: "Stop", style: "danger", confirm: null, input: null, href: null }],
37 });
38 assert.equal("actions" in card, false);
39 assert.deepEqual(shownCard({ kind: "x", title: "x", detail: null, state: null, href: null }), {
40 kind: "x",
41 title: "x",
42 detail: null,
43 state: null,
44 href: null,
45 });
46});