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.2 kB ยท 41 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142import { expect } from "@std/expect";import { afterEach, beforeEach, describe, it } from "@std/testing/bdd";
import { getBaseUrl } from "./base-url";
let originalEnv: string | undefined;
beforeEach(() => { originalEnv = process.env.NODE_ENV;});
afterEach(() => { Object.assign(process.env, { NODE_ENV: originalEnv }); if (originalEnv === undefined) Reflect.deleteProperty(process.env, "NODE_ENV");});
function setNodeEnv(value: string) { Object.assign(process.env, { NODE_ENV: value });}
describe("getBaseUrl", () => { it("uses the openstatus subdomain by default", () => { setNodeEnv("production"); expect(getBaseUrl({ slug: "acme" })).toBe("https://acme.openstatus.dev"); });
it("prefers the custom domain", () => { setNodeEnv("production"); expect(getBaseUrl({ slug: "acme", customDomain: "status.acme.com" })).toBe( "https://status.acme.com", ); });
it("serves from localhost in development, ignoring the custom domain", () => { setNodeEnv("development"); expect(getBaseUrl({ slug: "acme", customDomain: "status.acme.com" })).toBe( "http://localhost:3000/acme", ); });});