mirror of
https://github.com/tiennm99/bsk.git
synced 2026-08-05 16:23:38 +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.
36 lines
917 B
TypeScript
36 lines
917 B
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
export default defineConfig({
|
|
testDir: "tests/e2e",
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: "list",
|
|
use: {
|
|
baseURL: "http://127.0.0.1:3000",
|
|
trace: "on-first-retry",
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
name: "chromium",
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
],
|
|
|
|
webServer: {
|
|
command: "pnpm build && pnpm start",
|
|
url: "http://127.0.0.1:3000",
|
|
reuseExistingServer: !process.env.CI,
|
|
env: {
|
|
NEXT_PUBLIC_APP_ENV: "dev",
|
|
NEXT_PUBLIC_SUPABASE_URL: "https://placeholder.supabase.co",
|
|
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: "sb_publishable_x",
|
|
SUPABASE_SECRET_KEY: "sb_secret_x",
|
|
UPSTASH_REDIS_REST_URL: "https://placeholder.upstash.io",
|
|
UPSTASH_REDIS_REST_TOKEN: "x",
|
|
},
|
|
},
|
|
});
|