diff --git a/apps/mobile/src/a11y-scan.test.ts b/apps/mobile/src/a11y-scan.test.ts index 941d661..24e5f26 100644 --- a/apps/mobile/src/a11y-scan.test.ts +++ b/apps/mobile/src/a11y-scan.test.ts @@ -9,7 +9,9 @@ import { contrast, stripComments, unlabelledControls } from "./a11y-scan.ts"; import { palettes } from "./theme.ts"; const SRC = new URL(".", import.meta.url).pathname; -const files = ["app", "components"].flatMap((dir) => readdirSync(join(SRC, dir)).filter((f) => f.endsWith(".tsx")).map((f) => join(dir, f))).concat(["app-lock.tsx"]); +const files = ["app", "components"] + .flatMap((dir) => readdirSync(join(SRC, dir), { recursive: true }).map(String).filter((f) => f.endsWith(".tsx")).map((f) => join(dir, f))) + .concat(readdirSync(SRC).filter((f) => f.endsWith(".tsx"))); test("the scanner flags a Pressable without a role or a label", () => { const src = ` go("/x")} style={s}>\n{t("a.b")}`; @@ -36,6 +38,12 @@ test("every control on every screen has a role and a label from copy", () => { assert.deepEqual(found, []); }); +test("the scan includes nested route folders and top-level tsx screens in src", () => { + assert.ok(files.includes(join("app", "oauth", "mcp.tsx"))); + assert.ok(files.includes(join("app", "oauth", "microsoft.tsx"))); + assert.ok(files.includes("app-lock.tsx")); +}); + test("contrast is computed as WCAG defines it", () => { assert.equal(Math.round(contrast("#000000", "#FFFFFF") * 10) / 10, 21); assert.equal(contrast("#777777", "#777777"), 1);