| 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; |
| 3 | |
| 4 | import { SESSION_STATES, sessionChip } from "./session-card.ts"; |
| 5 | |
| 6 | test("a session card's state reads as what is happening", () => { |
| 7 | assert.deepEqual(sessionChip("Working"), { tone: "accent", live: true }); |
| 8 | assert.deepEqual(sessionChip("Needs approval"), { tone: "warn", live: false }); |
| 9 | assert.deepEqual(sessionChip("Done"), { tone: "success", live: false }); |
| 10 | assert.deepEqual(sessionChip("Failed"), { tone: "danger", live: false }); |
| 11 | assert.deepEqual(sessionChip("Stopped"), { tone: "neutral", live: false }); |
| 12 | assert.deepEqual(sessionChip("Queued"), { tone: "neutral", live: false }); |
| 13 | assert.equal(sessionChip("Waiting on helpers").live, true); |
| 14 | }); |
| 15 | |
| 16 | test("every state has a chip, whatever its case; an unknown one is quiet", () => { |
| 17 | for (const state of SESSION_STATES) assert.ok(sessionChip(state.toUpperCase())); |
| 18 | assert.deepEqual(sessionChip("Exploding"), { tone: "neutral", live: false }); |
| 19 | assert.deepEqual(sessionChip(null), { tone: "neutral", live: false }); |
| 20 | }); |