script.test.ts
1// Covers kepr.js's start: every island it calls is defined, so one missing name can't stop the2// rest of the page's scripts.34import { expect, test } from "bun:test";56const script = await Bun.file(new URL("../public/js/kepr.js", import.meta.url)).text();78test("every function kepr.js calls at start is defined in it", () => {9 const started = [...script.matchAll(/^(\w+)\(/gm)].map((match) => match[1] as string);10 expect(started.length).toBeGreaterThan(5);11 for (const name of started) {12 expect(`${name} ${new RegExp(`^(async )?function ${name}\\(`, "m").test(script)}`).toBe(13 `${name} true`,14 );15 }16});