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.7 kB ยท 43 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344import { expect } from "@std/expect";import { describe, test } from "@std/testing/bdd";
import { isCanonicalThemeExplorerHost, isThemeExplorerHost,} from "./theme-explorer-host";
describe("isThemeExplorerHost", () => { test("allows the canonical host", () => { expect(isThemeExplorerHost("themes.openstatus.dev")).toBe(true); expect(isThemeExplorerHost("THEMES.OPENSTATUS.DEV")).toBe(true); });
test("allows the internal origin and local/preview hosts", () => { expect(isThemeExplorerHost("www.stpg.dev")).toBe(true); expect(isThemeExplorerHost("stpg.dev")).toBe(true); expect(isThemeExplorerHost("localhost:3000")).toBe(true); expect(isThemeExplorerHost("status-page-git-main.vercel.app")).toBe(true); });
test("rejects status page hosts", () => { expect(isThemeExplorerHost("acme.openstatus.dev")).toBe(false); expect(isThemeExplorerHost("acme.stpg.dev")).toBe(false); expect(isThemeExplorerHost("status.acme.com")).toBe(false); expect(isThemeExplorerHost("acme.localhost:3000")).toBe(false); });
test("rejects look-alike hosts", () => { expect(isThemeExplorerHost("themes.openstatus.dev.evil.com")).toBe(false); expect(isThemeExplorerHost("eviltheme.openstatus.dev")).toBe(false); expect(isThemeExplorerHost(null)).toBe(false); expect(isThemeExplorerHost(undefined)).toBe(false); });});
describe("isCanonicalThemeExplorerHost", () => { test("only the published host is indexable", () => { expect(isCanonicalThemeExplorerHost("themes.openstatus.dev")).toBe(true); expect(isCanonicalThemeExplorerHost("www.stpg.dev")).toBe(false); expect(isCanonicalThemeExplorerHost("localhost:3000")).toBe(false); });});