mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-01-14 18:44:35 +01:00
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
const { describe, test } = require("node:test");
|
|
const assert = require("node:assert");
|
|
const StatusPage = require("../../server/model/status_page");
|
|
const {
|
|
STATUS_PAGE_ALL_UP,
|
|
STATUS_PAGE_ALL_DOWN,
|
|
STATUS_PAGE_PARTIAL_DOWN,
|
|
STATUS_PAGE_MAINTENANCE,
|
|
} = require("../../src/util");
|
|
|
|
describe("StatusPage", () => {
|
|
describe("getStatusDescription()", () => {
|
|
test("returns 'No Services' when status is -1", () => {
|
|
const description = StatusPage.getStatusDescription(-1);
|
|
assert.strictEqual(description, "No Services");
|
|
});
|
|
|
|
test("returns 'All Systems Operational' when all services are up", () => {
|
|
const description = StatusPage.getStatusDescription(STATUS_PAGE_ALL_UP);
|
|
assert.strictEqual(description, "All Systems Operational");
|
|
});
|
|
|
|
test("returns 'Partially Degraded Service' when some services are down", () => {
|
|
const description = StatusPage.getStatusDescription(STATUS_PAGE_PARTIAL_DOWN);
|
|
assert.strictEqual(description, "Partially Degraded Service");
|
|
});
|
|
|
|
test("returns 'Degraded Service' when all services are down", () => {
|
|
const description = StatusPage.getStatusDescription(STATUS_PAGE_ALL_DOWN);
|
|
assert.strictEqual(description, "Degraded Service");
|
|
});
|
|
|
|
test("returns 'Under maintenance' when status page is in maintenance", () => {
|
|
const description = StatusPage.getStatusDescription(STATUS_PAGE_MAINTENANCE);
|
|
assert.strictEqual(description, "Under maintenance");
|
|
});
|
|
|
|
test("returns '?' for unknown status values", () => {
|
|
const description = StatusPage.getStatusDescription(999);
|
|
assert.strictEqual(description, "?");
|
|
});
|
|
});
|
|
});
|