import { createRequire } from "node:module"; import { describe, expect, it } from "vitest"; (globalThis as unknown as { self: unknown }).self = { addEventListener() {} }; const require = createRequire(import.meta.url); const { istCachebar } = require("../../public/sw.js") as { istCachebar: (p: string) => boolean }; describe("istCachebar", () => { it.each(["/_next/static/chunks/a.js", "/app-icon/f/v/192.png", "/fonts/a.woff2"])( "cached %s", (p) => expect(istCachebar(p)).toBe(true) ); it.each([ "/", "/dashboard", "/auftraege/x", "/manifest.webmanifest", "/firma/logo", "/api/notifications/dispatch", "/offline.html", "/brand/widmann-logo.svg", ])("cached nicht %s", (p) => expect(istCachebar(p)).toBe(false)); });