import { assertEquals } from "@std/assert"; Deno.test("mod.ts, the docs' index page, links every documented module", async () => { const doc = await Deno.readTextFile("mod.ts"); const linked = new Set( [...doc.matchAll(/\]\(\.\/(\S+?\.tsx?)\/index\.html\)/g)].map((m) => m[1]), ); const modules: string[] = []; async function walk(dir: string) { for await (const entry of Deno.readDir(dir)) { const path = `${dir}/${entry.name}`; if (entry.isDirectory) { if (entry.name !== "test" && path !== "src/locales") await walk(path); } else if (/\.tsx?$/.test(entry.name)) modules.push(path); } } await walk("api"); await walk("shared"); await walk("src"); assertEquals(modules.filter((m) => !linked.has(m)), []); assertEquals([...linked].filter((m) => !modules.includes(m)), []); });