mirror of
https://github.com/tiennm99/bsk.git
synced 2026-08-04 20:27:24 +00:00
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.
60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
verify:
|
|
name: Lint / Typecheck / Build
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# Dummy values so build can resolve env schema.
|
|
# Real secrets live in the Vercel project, never in CI.
|
|
NEXT_PUBLIC_APP_ENV: preview
|
|
NEXT_PUBLIC_SUPABASE_URL: https://example.supabase.co
|
|
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: sb_publishable_ci_placeholder
|
|
SUPABASE_SECRET_KEY: sb_secret_ci_placeholder
|
|
UPSTASH_REDIS_REST_URL: https://example.upstash.io
|
|
UPSTASH_REDIS_REST_TOKEN: ci_placeholder
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
- name: Secret-leak guard (sb_secret_* in NEXT_PUBLIC_*)
|
|
run: pnpm check:no-secret-leak
|
|
|
|
- name: Format check
|
|
run: pnpm format:check
|
|
|
|
- name: Unit tests
|
|
run: pnpm test
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- 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.
|