Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.5 kB ยท 56 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657import { expect } from "@std/expect";import { describe, test } from "@std/testing/bdd";
import { computeEffectiveStatus } from "./effective-status";
describe("computeEffectiveStatus", () => { test("escalates operational to minor at/above threshold", () => { const result = computeEffectiveStatus({ providerIndicator: "none", providerStatus: "operational", reporters: 7, threshold: 7, }); expect(result).toEqual({ indicator: "minor", status: "operational", escalated: true, }); });
test("does not escalate below threshold", () => { const result = computeEffectiveStatus({ providerIndicator: "none", providerStatus: "operational", reporters: 6, threshold: 7, }); expect(result.escalated).toBe(false); expect(result.indicator).toBe("none"); });
test("never lowers or alters a provider status already at/above minor", () => { const result = computeEffectiveStatus({ providerIndicator: "major", providerStatus: "partial_outage", reporters: 100, threshold: 7, }); expect(result).toEqual({ indicator: "major", status: "partial_outage", escalated: false, }); });
test("does not escalate during maintenance", () => { const result = computeEffectiveStatus({ providerIndicator: "none", providerStatus: "under_maintenance", reporters: 100, threshold: 7, }); expect(result.escalated).toBe(false); expect(result.indicator).toBe("none"); });});