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.

21 linesCodeBlameRaw
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { groupWorkflows, isArchivedWorkflow } from "./workflow-history.ts";
4
5test("only a removed file is archived, not a disabled, invalid or branch-only workflow", () => {
6 const current = [
7 { id: "active", error: null },
8 { id: "disabled", error: null, state: "disabled" },
9 { id: "invalid", error: "Invalid YAML" },
10 { id: "branch", error: "Its file is not on the default branch." },
11 ];
12 const removed = { id: "removed", error: "Its file is no longer on the default branch." };
13 assert.deepEqual(groupWorkflows([current[0], removed, ...current.slice(1)]), { current, archived: [removed] });
14 assert.equal(isArchivedWorkflow({ ...removed, error: null }), false);
15});
16
17test("an archive-only repository keeps its workflow history available", () => {
18 const removed = { id: "old", error: "Its file is no longer on the default branch." };
19 assert.deepEqual(groupWorkflows([removed]), { current: [], archived: [removed] });
20 assert.deepEqual(groupWorkflows([]), { current: [], archived: [] });
21});