cache-headers.test.ts
This file
Path
apps/web/test/cache-headers.test.ts
26 lines · 862 bytes · TypeScript
Last changed by
Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248
History of this fileTake it
Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
lines 1–2why, one step back1import { describe, expect, it } from "@effect/vitest";2Merge fix/w12-reviewoscabrielbefore adoption7b8b393
lines 3–4why, one step back3import * as CacheHeaders from "../src/server/cache-headers.ts";4import { branchPage, personalPage } from "../src/server/cache-headers.ts";Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
lines 5–6why, one step back56describe("a page's cache headers", () => {Merge fix/w12-reviewoscabrielbefore adoption7b8b393
lines 7–12why, one step back7 it("keeps no page for good: each one carries what a landing may change", () => {8 expect(9 Object.values(CacheHeaders).filter((headers) =>10 headers["Cache-Control"].includes("immutable")11 )12 ).toStrictEqual([]);Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
lines 13–26why, one step back13 });1415 it("keeps a page at main or a tag briefly, and serves it stale while it asks again", () => {16 expect(branchPage).toStrictEqual({17 "Cache-Control": "public, max-age=30, stale-while-revalidate=300",18 });19 });2021 it("keeps a page about its reader nowhere", () => {22 expect(personalPage).toStrictEqual({23 "Cache-Control": "private, no-store",24 });25 });26});