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 ยท 33 lines
TypeScript
12345678910111213141516171819202122232425262728293031323334import { expect } from "@std/expect";import { describe, test } from "@std/testing/bdd";
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); });});