| 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; |
| 3 | |
| 4 | import { STATUS_JSON_URL, dotClass, statusTitle } from "./status.ts"; |
| 5 | |
| 6 | test("the status page lives on its own host", () => { |
| 7 | assert.equal(STATUS_JSON_URL, "https://status.g1t.sh/status.json"); |
| 8 | }); |
| 9 | |
| 10 | test("the short line is the report's title, else words for its state", () => { |
| 11 | assert.equal(statusTitle({ overall: { state: "up", title: "All systems normal", line: "" } }), "All systems normal"); |
| 12 | assert.equal(statusTitle({ overall: { state: "down", title: "", line: "" } }), "Major outage"); |
| 13 | assert.equal(statusTitle(null), null); |
| 14 | }); |
| 15 | |
| 16 | test("each state has its own dot", () => { |
| 17 | assert.equal(dotClass("up"), "bg-accent"); |
| 18 | assert.equal(dotClass("degraded"), "bg-warn"); |
| 19 | assert.equal(dotClass("down"), "bg-danger"); |
| 20 | assert.equal(dotClass("unknown"), "bg-faint"); |
| 21 | assert.equal(dotClass(null), "bg-faint"); |
| 22 | }); |