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.0 kB ยท 32 lines
TypeScript
123456789101112131415161718192021222324252627282930313233import { describe, expect, test } from "vitest";
import { markdownCacheControl } from "./markdown-cache-control";
const PUBLIC_CACHE = "public, max-age=60, s-maxage=60, stale-while-revalidate=300";const NO_STORE = "private, no-store";
describe("markdownCacheControl", () => { test("public page via .md suffix is edge-cacheable", () => { expect(markdownCacheControl("suffix", "public")).toBe(PUBLIC_CACHE); });
test("gated pages are never cacheable, even via .md suffix", () => { for (const accessType of [ "password", "email-domain", "ip-restriction", ] as const) { expect(markdownCacheControl("suffix", accessType)).toBe(NO_STORE); } });
test("header-negotiated requests are never edge-cached", () => { expect(markdownCacheControl("header", "public")).toBe(NO_STORE); });
test("unknown/absent access type is not cacheable", () => { expect(markdownCacheControl("suffix", null)).toBe(NO_STORE); expect(markdownCacheControl("suffix", undefined)).toBe(NO_STORE); });});