{"draft":null,"from":2,"to":318,"files":[{"path":"client/test/queue-waiting.test.ts","added":50,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/queue-waiting.test.ts\n@@ -0,0 +1,50 @@\n+// What abso waiting --mine says about your own publishes in the merge queue: where each stands, a pause, and how\n+// the outcome comes. Nothing when none of yours waits.\n+\n+import assert from \"node:assert/strict\";\n+import { describe, it } from \"node:test\";\n+import type { QueueItem, QueueState } from \"../src/api.ts\";\n+import { queuedLines } from \"../src/queue.ts\";\n+\n+const item = (id: number, agent: string, checking = false): QueueItem => ({\n+\tid,\n+\tagent,\n+\tmessage: `push ${id}`,\n+\ttime: 0,\n+\tchanges: 1,\n+\tchecking,\n+});\n+const state = (items: QueueItem[], paused: QueueState[\"paused\"] = null): QueueState =>\n+\t({ items, paused }) as unknown as QueueState;\n+\n+describe(\"waiting: your pushes in the merge queue\", () => {\n+\tit(\"says nothing when none of yours waits, or there's no queue to read\", () => {\n+\t\tassert.deepEqual(queuedLines(undefined, \"ann\"), []);\n+\t\tassert.deepEqual(queuedLines(state([]), \"ann\"), []);\n+\t\tassert.deepEqual(queuedLines(state([item(1, \"bob\")]), \"ann\"), []);\n+\t});\n+\n+\tit(\"says where yours stands, and how the outcome comes\", () => {\n+\t\tassert.deepEqual(queuedLines(state([item(1, \"bob\", true), item(2, \"ann\")]), \"ann\"), [\n+\t\t\t'Your push 2 (\"push 2\") is in the merge queue: waiting, 1 push ahead of it.',\n+\t\t\t\"It lands or is turned back once the project's check runs on it; the outcome comes as news, and abso unqueue takes it back.\",\n+\t\t]);\n+\t\tassert.deepEqual(queuedLines(state([item(3, \"ann\", true), item(4, \"bob\", true), item(5, \"ann\")]), \"ann\"), [\n+\t\t\t'Your push 3 (\"push 3\") is in the merge queue: being checked in a batch of 2.',\n+\t\t\t'Your push 5 (\"push 5\") is in the merge queue: waiting, 2 pushes ahead of it.',\n+\t\t\t\"Each lands or is turned back once the project's check runs on it; the outcome comes as news, and abso unqueue takes them back.\",\n+\t\t]);\n+\t});\n+\n+\tit(\"says when the queue is paused\", () => {\n+\t\tconst paused = {\n+\t\t\treason: \"the box failed twice\",\n+\t\t\tsince: \"2026-01-01T00:00:00.000Z\",\n+\t\t\tnextTry: \"2026-01-01T00:05:00.000Z\",\n+\t\t};\n+\t\tassert.equal(\n+\t\t\tqueuedLines(state([item(1, \"ann\")], paused), \"ann\")[1],\n+\t\t\t\"The merge queue is paused: the box failed twice.\",\n+\t\t);\n+\t});\n+});"}],"unmatched":[]}