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 ยท 55 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import { describe, expect, test } from "vitest";
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"); });});