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 { parseFlyRequestId } from "./fly-request-id";
describe("parseFlyRequestId", () => { it("resolves the region from the trailing iata code", () => { const result = parseFlyRequestId("01h2abcxyz9876-ams"); expect(result.status).toBe("success"); if (result.status === "success") { expect(result.data.code).toBe("ams"); expect(result.data.location).toBe("Amsterdam, Netherlands"); } });
it("fails when the region is not in the list", () => { const result = parseFlyRequestId("01h2abcxyz9876-zzz"); expect(result.status).toBe("failed"); if (result.status === "failed") { expect(result.error.message).toContain("zzz"); expect(result.error.message).toContain("not listed"); } });
it("fails when the header carries no region code", () => { const result = parseFlyRequestId("0123456789"); expect(result.status).toBe("failed"); if (result.status === "failed") { expect(result.error.message).toBe("Couldn't parse the header."); } });});