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.1 kB ยท 32 lines
TypeScript
123456789101112131415161718192021222324252627282930313233import { expect } from "@std/expect";import { describe, it } from "@std/testing/bdd";
import { parseCfCacheStatus } from "./cf-cache-status";
describe("parseCfCacheStatus", () => { for (const [value, expectedFragment] of [ ["HIT", "found in Cloudflare"], ["MISS", "did not find it"], ["BYPASS", "not cache this asset"], ["EXPIRED", "cache has expired"], ["DYNAMIC", "not cached by default"], ]) { it(`describes the documented state ${value}`, () => { const result = parseCfCacheStatus(value); expect(result.value).toBe(value); expect(result.description).toContain(expectedFragment); }); }
it("matches the state case insensitively and echoes the raw header", () => { const result = parseCfCacheStatus("hit"); expect(result.value).toBe("hit"); expect(result.description).toContain("found in Cloudflare"); });
it("falls back to a placeholder for an unknown state", () => { const result = parseCfCacheStatus("REVALIDATED"); expect(result.value).toBe("REVALIDATED"); expect(result.description).toBe("-"); });});