Files
mangabaka-seeder/test/template.test.ts
T

12 lines
493 B
TypeScript

import { expect, test } from "bun:test";
import { APP_HTML } from "../src/web/template";
test("every element app.ts looks up exists in the template exactly once", async () => {
const app = await Bun.file("src/web/app.ts").text();
const wanted = [...app.matchAll(/\bq<[^>]+>\("([a-z-]+)"\)/g)].map((m) => m[1]!);
expect(wanted.length).toBeGreaterThan(30);
for (const id of wanted) {
expect({ id, count: APP_HTML.split(`id="${id}"`).length - 1 }).toEqual({ id, count: 1 });
}
});