| 1 | // Run: tsx src/__tests__/recovery-banner-privacy.test.ts |
| 2 | |
| 3 | import { readFileSync } from "node:fs"; |
| 4 | import { dirname, resolve } from "node:path"; |
| 5 | import { fileURLToPath } from "node:url"; |
| 6 | |
| 7 | let passed = 0; |
| 8 | let failed = 0; |
| 9 | |
| 10 | function ok(cond: boolean, label: string) { |
| 11 | if (cond) { |
| 12 | process.stdout.write(` PASS ${label}\n`); |
| 13 | passed += 1; |
| 14 | } else { |
| 15 | process.stdout.write(` FAIL ${label}\n`); |
| 16 | failed += 1; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | const here = dirname(fileURLToPath(import.meta.url)); |
| 21 | const appSource = readFileSync(resolve(here, "../App.tsx"), "utf8"); |
| 22 | |
| 23 | console.log("\nquiet recovery prompt privacy"); |
| 24 | |
| 25 | ok(!appSource.includes("banner--recovery"), "App does not render a persistent recovery banner"); |
| 26 | ok(!appSource.includes("recoveryDigest"), "App does not expose recovery digest through recovery prompts"); |
| 27 | ok(!appSource.includes("recoveryParentId"), "App does not expose parent session id through recovery prompts"); |
| 28 | ok(!appSource.includes("recoveryBannerTitle"), "App does not build a detailed recovery tooltip"); |
| 29 | |
| 30 | console.log(`\n${passed} passed, ${failed} failed`); |
| 31 | if (failed > 0) process.exit(1); |
| 32 |