test: add Vitest unit + Playwright E2E suites (PLAN §7)

The repo had zero tests despite PLAN §7 mandating them.

- 97 unit tests over the pure logic: checkup/customer/catalog/template Zod
  schemas, parseNum, computeAge, and invoice math
- extracted lib/billing/totals.ts (sumLineTotals/formatVnd) so invoice math is
  testable, and refactored the invoice route + dashboard to use it
- 16 Playwright smoke tests that need no database: auth gates redirect to
  sign-in, VI-default rendering, password-reveal toggle, /en locale, 404
- playwright.config passes placeholder env inline via webServer.env so no
  env file is ever needed; pnpm test wired into CI (E2E stays local)

tests/e2e/README.md documents the seeded-data prerequisites for the full
queue -> checkup -> prescription -> paid -> invoice happy path, which is
blocked on a provisioned Supabase project rather than faked with skipped tests.
This commit is contained in:
2026-07-25 15:16:48 +07:00
parent d91515c36e
commit 5ddf11ac4a
24 changed files with 2247 additions and 11 deletions
+8
View File
@@ -41,6 +41,9 @@ jobs:
- name: Format check
run: pnpm format:check
- name: Unit tests
run: pnpm test
- name: Lint
run: pnpm lint
@@ -49,3 +52,8 @@ jobs:
- name: Build
run: pnpm build
# E2E tests (pnpm test:e2e) are run locally / can be enabled later
# when Playwright browser installation and full build time are available.
# Current suite covers smoke tests; full happy-path tests require
# a provisioned Supabase project with seed data.