Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { expect, test } from "@playwright/test";
/**
* Cluster C Playwright sweep — content-addressed URL invalidation.
* Registering a SW configured with `contentAddressed: true` MUST delete
* every previously-installed cache whose name starts with the
* configured prefix and is not in the `keep` list. The page-side
* harness exposes `/sw-cache-names` to read the live cache names.
*/
test.describe("content-addressed cache invalidation (cluster C)", () => {
test("activate handler drops outdated caches", async ({ page }) => {
await page.goto("/");
await page.evaluate(async () => {
const win = window as unknown as {
seedStaleCache?: () => Promise<void>;
};
if (typeof win.seedStaleCache === "function") {
await win.seedStaleCache();
}
await navigator.serviceWorker.register("/service-worker.js");
await navigator.serviceWorker.ready;
});
const names = await page.evaluate(async () => {
return await caches.keys();
});
// After activate, no stale cache name should remain.
expect(names.some((n) => n.startsWith("packed-resources-stale"))).toBe(
false
);
});
});