forked from fahrPool/fahrPool
23 lines
765 B
TypeScript
23 lines
765 B
TypeScript
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", "/brand/widmann-logo.svg", "/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",
|
|
])("cached nicht %s", (p) => expect(istCachebar(p)).toBe(false));
|
|
});
|