g1t/apps/web/app/lib/status.test.ts

22 lines900 bytesCodeBlame
1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { STATUS_JSON_URL, dotClass, statusTitle } from "./status.ts";
5
6test("the status page lives on its own host", () => {
7 assert.equal(STATUS_JSON_URL, "https://status.g1t.sh/status.json");
8});
9
10test("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
16test("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});