Functional Weave
Code in TypeScript

monitor.status-page@1.0.0

vectors.json

3,076 bytes · view raw

[
  {"name": "every component operational is all systems operational", "args": [[{"name": "API", "state": "operational"}, {"name": "Website", "state": "operational"}]], "expect": {"state": "operational", "headline": "All systems operational", "affected": []}},
  {"name": "one degraded component makes the page degraded and names it", "args": [[{"name": "API", "state": "operational"}, {"name": "Search", "state": "degraded"}]], "expect": {"state": "degraded", "headline": "Degraded performance", "affected": ["Search"]}},
  {"name": "a partial outage beats degraded; affected keeps input order", "args": [[{"name": "Search", "state": "degraded"}, {"name": "API", "state": "partial-outage"}, {"name": "Website", "state": "operational"}]], "expect": {"state": "partial-outage", "headline": "Partial outage", "affected": ["Search", "API"]}},
  {"name": "a major outage beats everything", "args": [[{"name": "API", "state": "partial-outage"}, {"name": "Database", "state": "major-outage"}, {"name": "Docs", "state": "maintenance"}]], "expect": {"state": "major-outage", "headline": "Major outage", "affected": ["API", "Database", "Docs"]}},
  {"name": "maintenance alone is the headline and the component is affected", "args": [[{"name": "API", "state": "operational"}, {"name": "Billing", "state": "maintenance"}]], "expect": {"state": "maintenance", "headline": "Scheduled maintenance", "affected": ["Billing"]}},
  {"name": "degraded outranks maintenance, a naive enum order gets this wrong", "args": [[{"name": "Billing", "state": "maintenance"}, {"name": "API", "state": "degraded"}]], "expect": {"state": "degraded", "headline": "Degraded performance", "affected": ["Billing", "API"]}},
  {"name": "a single operational component", "args": [[{"name": "API", "state": "operational"}]], "expect": {"state": "operational", "headline": "All systems operational", "affected": []}},
  {"name": "a single component in major outage", "args": [[{"name": "API", "state": "major-outage"}]], "expect": {"state": "major-outage", "headline": "Major outage", "affected": ["API"]}},
  {"name": "names differing only in case are different components", "args": [[{"name": "api", "state": "operational"}, {"name": "API", "state": "degraded"}]], "expect": {"state": "degraded", "headline": "Degraded performance", "affected": ["API"]}},
  {"name": "a page with no components is an error", "args": [[]], "expectError": "components must not be empty"},
  {"name": "a duplicate name is an error", "args": [[{"name": "API", "state": "operational"}, {"name": "API", "state": "major-outage"}]], "expectError": "duplicate component name: API"},
  {"name": "an empty name is an error", "args": [[{"name": "", "state": "operational"}]], "expectError": "component name must not be empty"},
  {"name": "an unknown state is an error", "args": [[{"name": "API", "state": "down"}]], "expectError": "unknown component state: down"},
  {"name": "Statuspage's snake_case spelling is not accepted", "args": [[{"name": "API", "state": "major_outage"}]], "expectError": "unknown component state: major_outage"}
]