Testing Strategy
This document outlines the testing strategy, test architecture, and quality assurance workflows for the wedding website project. The project maintains an automated, full-coverage testing suite enforced across unit, integration, accessibility, and end-to-end quality gates in continuous integration.
Tech Stack
- Unit & Integration Framework: Jest partitioned into parallel
unit-node, parallelunit-jsdom, and serialdb-serialprojects in jest.config.mjs. - Component Testing Utilities: React Testing Library
- Environment: Native
nodeenvironment for pure TypeScript and PostgreSQL suites, and custom JSDOM (jsdom-env.cjs withnode:timershandles and jest.setup.jsdom.js) for component, hook, demo, export-download, and portal browser suites. - End-to-End Testing: Playwright for headless browser automation.
- Language: TypeScript, with tests written in
.test.tsand.test.tsxfiles. - Database & ORM: Prisma with automated PostgreSQL container isolation via Docker Compose.
How to Run Tests
Running Unit & Integration Tests
Run the unit and integration test suite across parallel unit-node and unit-jsdom workers plus the serial db-serial PostgreSQL runner without coverage instrumentation for fast local iteration:
npm test
# Run a single targeted test file (or customize parallel worker count with --maxWorkers):
npm test -- src/utils/__tests__/ApiError.test.ts
npm test -- --maxWorkers=2 src/utils/__tests__/ApiError.test.tsRun Jest in interactive watch mode during active development (without coverage overhead or global threshold failures):
npm run test:watchRun the full suite with global coverage threshold enforcement (80% lines, 68% branches) and lightweight terminal + coverage/lcov.info output:
npm run test:cov
# Explicitly build full interactive HTML coverage reports alongside lcov/json/clover:
npm run test:cov:htmlPretest Lifecycle & Database Automation
Before Jest executes, npm automatically triggers the pretest, pretest:watch, and pretest:cov lifecycle hooks in package.json, invoking scripts/pretest.mjs. Preflight steps combine CI-aware dependency/database preservation with local caching so warm targeted runs stay fast:
- CI-Aware Dependency Alignment & Strict
npm ci: Treatsnode_modulesas aligned whenCI=truewith an existingnode_modules/.package-lock.jsonor whennode_modules/.package-lock-hash(initialized duringnpm civiapostinstallrunningnode scripts/pretest.mjs --record-install-state) matches the SHA-256 digest ofpackage-lock.json. When local dependencies are missing or lockfile drift is detected, it runs strictnpm ci(enforcing peer dependency checks) and recordsnode_modules/.package-lock-hash. - Accessibility Violation Reset & Worker Shard Aggregation: Resets
test-results/jest-a11y-violations.jsonto[]and clears stale.jest-a11y-violations.shard-*.jsonfiles before every Jest run; during parallelunit-jsdomexecution, jest.setup.jsdom.js and jest-a11y-reporter.cjs write per-worker shard files and aggregate them atomically intotest-results/jest-a11y-violations.jsonso component-leveljest-axeassertions report only current violations without cross-worker write races. - Test Environment Isolation,
CI=truePreservation &TEST_DATABASE_URLOverride: Bothscripts/pretest.mjsand jest.setup.js honor explicitTEST_DATABASE_URLoverrides (when targeting a custom PostgreSQL instance) or preserve the caller'sDATABASE_URLwhenCI=true, while still loading test defaults from.env.test(GUEST_PASSCODE="build-fallback-guest-passcode",GUEST_SESSION_SECRET="playwright-e2e-session-secret-32-chars-min"). Locally (when neitherCI=truenorTEST_DATABASE_URLis set), they clear parent shell database and admin variables (DATABASE_URL,POSTGRES_URL_NON_POOLING,PGDATABASE,PGUSER,PGPASSWORD,PGHOST,PGPORT,PGDATASOURCE,ADMIN_PASSWORD) and target the isolatedwedding_testdatabase (postgresql://wedding:wedding123@localhost:5432/wedding_test?schema=public) so test runs never modify local development data. - TCP Readiness Probing & Conditional PostgreSQL Container Startup: Probes TCP readiness on the host and port parsed from
DATABASE_URL(node:net) before invoking Docker Compose. When a PostgreSQL listener already accepts connections (such as GitHub Actionsservices.dbor an active local database) or whenCI=true,docker compose up -d dbis skipped. Locally, when the target port is offline and Docker (docker info) is running, it starts the container viadocker compose --env-file .env.ci -f docker-compose.yml -f docker-compose.ci.yml up -d dband pollspg_isready -U weddinguntil ready; if Docker is unavailable, it logs a notice and falls back gracefully. - Cached Migration Synchronization & Conditional Prisma Client Generation: When PostgreSQL is reachable, ensures isolated test databases (
wedding_test) exist and tracksprisma/schema.prisma,prisma/migrations/, and target database URL state innode_modules/.cache/pretest-state.json, skipping repeatednpx prisma migrate deploy(which automatically resets unbaselinedprisma db pushschemas on Prisma errorP3005and retries once) when committed migrations are already up to date. When PostgreSQL is offline,scripts/pretest.mjslogs a warning, leavesdbSyncuncached (so migrations run automatically once PostgreSQL becomes reachable), and skipsnpx prisma migrate deployso database-freeunit-nodeandunit-jsdomsuites can execute offline — unlessCI_REQUIRE_DB=trueor--require-dbis set (as in theunit-testCI job, which fails preflight immediately ifservices.dbis unreachable).npm run prisma:generatestill runs offline whenevernode_modules/.prisma/clientis missing or stale (while skipping duplicate generation afterpostinstallin CI, whereunit-testrunsSKIP_NEXT_TYPEGEN=true npm ci). Documentation portal staging is intentionally omitted from preflight and handled directly by dedicated portal suites (src/__tests__/generate-portal.test.ts) andnpm run docs:build.
Test Structure & Architecture
Tests are modular and co-located with their respective application domains and features:
- Feature Modules: Feature-specific services, repositories, schemas, and integration suites live in
src/features/<feature>/__tests__/. For example:- Feature service tests: src/features/registry/tests/service.test.ts
- Admin feature tests:
src/features/admin/__tests__/ - Broadcast feature tests:
src/features/broadcast/__tests__/service.test.ts - Seating service tests:
src/features/seating/__tests__/admin.service.test.ts - Content integration tests:
src/features/content/__tests__/content.integration.test.ts
- Core Infrastructure & Authentication: Framework-level utilities, server components, and security logic reside in
src/core/<module>/__tests__/. For example:- Infrastructure service tests: src/core/infrastructure/tests/service.test.ts
- Admin auth & session tests:
src/core/auth/__tests__/adminAuth.test.ts
- UI Components: Reusable React component tests are located in
src/components/__tests__/as well as domain subdirectories such assrc/components/ui/__tests__/,src/components/admin/__tests__/, andsrc/components/photos/__tests__/. - API Route Handlers: HTTP endpoint handlers and route middleware tests are located in
src/app/api/__tests__/and respective sub-route directories (e.g.src/features/registry/api/__tests__/). - Shared Libraries & Utilities: Common utilities, formatting helpers, and configuration parsers are tested in
src/utils/__tests__/andsrc/lib/__tests__/. - End-to-End Specs: Multi-step guest and administrative browser workflows are located in
e2e/.
Quality Gates & Verification Workflows
The codebase enforces strict quality gates in jest.config.mjs and GitHub Actions continuous integration (.github/workflows/ci.yml).
Jest Coverage Thresholds
Global coverage thresholds are enforced in jest.config.mjs (via scripts/jest/cli-options.mjs) only during unfiltered full-suite coverage runs (npm run test:cov, npm run test:cov:html, npm run quality, and the unit-test CI job) across all matched src/**/*.{ts,tsx} files. Threshold enforcement is skipped during standard npm test and npm run test:watch runs as well as targeted CLI invocations (such as explicit file paths, --testPathPatterns, --selectProjects, --onlyChanged, --findRelatedTests, or --shard) so single-file and project-scoped runs do not fail global coverage checks. Pull requests that drop full-suite test coverage below these thresholds fail CI:
- Lines: 80%
- Branches: 68%
By default, npm run test:cov emits lightweight text-summary terminal output and coverage/lcov.info (lcovonly). Run npm run test:cov:html (or set COVERAGE_HTML=true) when you need full interactive HTML reports under coverage/.
Verification & Quality Scripts
A variety of verification scripts in package.json support comprehensive local validation and CI quality gates:
Unit, Integration & Coverage Suites:
bashnpm test npm run test:covnpm testruns cached preflight automation followed byNODE_OPTIONS=--max-old-space-size=4096 jestwithout coverage instrumentation (caching transformed modules in<rootDir>/node_modules/.cache/jestviacacheDirectoryacrossunit-node,unit-jsdom, anddb-serial, executingunit-nodeandunit-jsdomin parallel withworkerIdleMemoryLimit: '1024MB'anddb-serialsequentially via jest-serial-runner.cjs), whilenpm run test:covrunsNODE_OPTIONS=--max-old-space-size=4096 jest --coveragein a single pass (persistingnode_modules/.cache/jestviaactions/cacheafterSKIP_NEXT_TYPEGEN=true npm ciin theunit-testCI job) to generatecoverage/lcov.info, aggregatetest-results/jest-a11y-violations.json, and enforce global coverage thresholds (80%lines,68%branches).Playwright End-to-End & Smoke Tests:
bashnpm run test:e2e # Fast smoke subset (@smoke): npm run test:e2e:smokeExecutes browser-based end-to-end tests in bundled Chromium against
http://localhost:3000backed by the isolatedwedding_testdatabase (honoring optionalPLAYWRIGHT_CHROMIUM_EXECUTABLE_PATHoverrides when set and retaining failure traces undertest-results/playwright/viatrace: 'retain-on-failure'). playwright.config.ts ignores e2e/pages-showcase.spec.ts during standard Playwright runs unless explicitly invoked vianpm run pages:verify.npm run test:e2e:smoke(playwright test --grep @smoke) runs the targeted fast smoke specs (e2e/guest-callback-url.spec.ts, e2e/meta.spec.ts, and e2e/skip-link.spec.ts) while excluding slow route crawlers in e2e/crawler.spec.ts and route violation writers in e2e/verification.spec.ts. In .github/workflows/ci.yml,e2e-test(npm ci --ignore-scripts, restoringnode_modules/@prismaandnode_modules/.prismafromnext-build-artifact, and runningnpx playwright test) starts immediately onceverifyandbuildsucceed without waiting forunit-testand uploads retained failure traces (playwright-traces,retention-days: 7) onif: failure().- Automated
wedding_testBootstrap: WhenCIandTEST_CONTAINERare unset, playwright.config.ts automatically starts the Docker Compose PostgreSQLdbcontainer (if Docker is running), synchronizes the schema (npx prisma db push --accept-data-loss), and seedsAppConfig(npx tsx scripts/seed.ts) inwedding_testbefore launchingnpm run devonhttp://localhost:3000and probing/api/ready. - Isolated Server Lifecycle & Explicit Reuse Opt-In: playwright.config.ts disables
reuseExistingServerby default so Playwright never silently reuses a runningnpm run devprocess bound to.env(which targets theweddingdevelopment database and uses localGUEST_SESSION_SECRET,GUEST_PASSCODE, andADMIN_PASSWORDvalues that causesrc/core/auth/guest.server.tsto reject E2E cookies). Stop any runningnpm run devon port3000before runningnpm run test:e2e(npx playwright test), or setPLAYWRIGHT_REUSE_SERVER=true(whenCIis unset) only when the existing server explicitly targetswedding_testand shares aligned E2E session secrets. - E2E Cookie Signing & Secret Alignment: Playwright specs authenticate using shared helpers in e2e/helpers/auth.ts, which sign
guest_authcookies withGUEST_SESSION_SECRETandadmin_authcookies with a domain-separated HMAC key derived from the decoded 64-byteADMIN_PASSWORDscrypt hash across bothhttp://127.0.0.1:3000andhttp://localhost:3000. - Default Local & Container Secrets: playwright.config.ts, .env.ci, docker-compose.ci.yml, .env.test, and e2e/helpers/auth.ts all align on the default 32+-character
GUEST_SESSION_SECRET(playwright-e2e-session-secret-32-chars-min) and 64-byte E2EADMIN_PASSWORDscrypt hash. ForGUEST_PASSCODE,playwright.config.ts,.env.ci,docker-compose.ci.yml, ande2e/helpers/auth.tsdefault toplaywright-e2e-guest-passcode(sonpx playwright testandTEST_CONTAINER=true npm run test:e2e:smokework on clean checkouts without.envor manual secret configuration when usingdocker compose --env-file .env.ci -f docker-compose.yml -f docker-compose.ci.yml), whereas.env.test(loaded byscripts/pretest.mjsfor Jest runs) setsGUEST_PASSCODEtobuild-fallback-guest-passcode. - Custom Secret Overrides: When overriding
GUEST_SESSION_SECRET,GUEST_PASSCODE, orADMIN_PASSWORDlocally or in CI, provide identical values to both the application server (or container) and the Playwright runner, ensuringGUEST_SESSION_SECRETis at least 32 characters long and never matchesGUEST_PASSCODE.
- Automated
Accessibility (A11y) Audits:
bash# Fast component-only jest-axe checks (auto-discovers src/ suites, no Docker required): npm run test:a11y:unit # Standalone static showcase light & dark WCAG 2.2 AA audit (no Docker or database required): NEXT_PUBLIC_BASE_PATH="/wedding_website/demo" npm run build:export NEXT_PUBLIC_BASE_PATH="/wedding_website/demo" npm run test:a11y:static # Standalone Storybook showcase light & dark WCAG 2.2 AA audit (no Docker or database required): NEXT_PUBLIC_BASE_PATH="/wedding_website/storybook" npm run build-storybook NEXT_PUBLIC_BASE_PATH="/wedding_website/storybook" npm run test:a11y:storybook # Full component + @a11y Playwright WCAG 2.2 AA audit: npm run test:a11ynpm run test:a11y:unitruns scripts/a11y-report.mjs (--unit), dynamically discovering everysrc/jest-axesuite viafindJestAxeSuites, executing them with--coverage=false, and recording component violations totest-results/jest-a11y-violations.json.npm run test:a11y:static(node scripts/a11y-report.mjs --static, delegating browser execution tonpm run test:e2e:staticvia playwright.static.config.ts and scripts/serve-static-export.mjs) serves the pre-builtout/directory underNEXT_PUBLIC_BASE_PATHwithout Docker, PostgreSQL, live Next.js servers, or external network calls, scanning all exported showcase routes in bothlightanddarkthemes (>= 62route/theme scans) and writingtest-results/static-a11y-violations.json+test-results/a11y-summary.md.npm run test:a11y:storybook(node scripts/a11y-report.mjs --storybook, buildingstorybook-static/automatically if absent and delegating browser execution tonpm run test:e2e:storybookvia playwright.storybook.config.ts and scripts/serve-static-export.mjs) servesstorybook-static/underNEXT_PUBLIC_BASE_PATHwithout Docker, PostgreSQL, or external network calls, scanning all43Storybook stories inindex.jsonacross bothlightanddarkthemes (86story/theme renders) with every WCAG 2.2 AA tag and explicit rule in src/a11y-config.ts while failing on console or HTTP errors and writingtest-results/storybook-a11y-violations.json+test-results/a11y-summary.md.npm run test:a11yrunsscripts/a11y-report.mjs(--run), which cleanstest-results/, runs the targeted--unitcomponent pass, reseedswedding_testvianpx tsx scripts/seed.ts(scripts/seed.ts) to restore validAppConfigdata wiped by Jest integration teardowns (skipping<SetupWizard />insrc/app/layout.tsx), runsnpx playwright test --grep @a11y, and writes unfiltered WCAG 2.2 AA violations totest-results/a11y-summary.md(for production standalone mode, runnpm run build && CI=true npm run test:a11y).- In .github/workflows/ci.yml, an isolated read-only
a11y-reportjob (contents: read) depends onunit-test,e2e-test,static-export-build, andstorybook-build(if: always() && !cancelled()), downloadsjest-a11y-violations,playwright-a11y-violations,static-a11y-violations, andstorybook-a11y-violations, invokesnode scripts/a11y-report.mjs --include-static --include-storybook --require-complete(escaping HTML, Markdown links, backticks, and newlines in violation fields and exiting1after writingtest-results/a11y-summary.mdwhenever violations exist, expected suite artifacts are missing, or JSON parsing fails, while omitting--require-completelocally preserves exit0for partial runs), uploadsa11y-summaryfor a downstream checkout-freea11y-report-commentjob (pull-requests: write,issues: write) to update the<!-- a11y-report -->pull request comment, writes$GITHUB_STEP_SUMMARYonif: always() && !cancelled(), and fails if any upstream suite job fails so botha11y-reportand the terminalci-completegate (if: always() && !cancelled(),timeout-minutes: 5, checkingresult == 'success'across all 9 verification jobs on non-cancelled runs) fail closed.
Standalone Server Smoke Test:
bashnpm run build npm run check:standalone -- --require-standalone npm run test:standaloneVerifies post-build standalone asset staging (
.next/standalone/server.js,.next/standalone/.next/static, and.next/standalone/publicviascripts/check-docker-build.ts; CIbuildinvokesnpm run check:standalone -- --standalone-onlysince static Dockerfile/Compose checks already run inverify) and runsscripts/test-standalone.mjs+scripts/smoke-runner.mjsto check PostgreSQL TCP readiness (pg_isready -h localhost), clean migrations (POSTGRES_URL_NON_POOLINGunset),/assets/favicon.png,/api/ready,/api/registry/validate-code, authenticated/api/registry/items, worker-based HEIC photo upload transcoding, unauthenticated/guest/loginredaction (Guest Sign-In | Wedding Website), and authenticatedSIGTERMlock draining (verifying exit code143before stopping PostgreSQL).Note:
npm run test:standalonerequires runningnpm run buildbeforehand (it exits immediately if.next/standalone/server.js,.next/standalone/.next/static, or.next/standalone/publicis missing). WhenDATABASE_URLis unset, it selects free loopbackPORTandDB_PORTvalues (honoringTEST_PORTandDB_PORToverrides), awaitsserver.jsSIGTERMexit code143, and runsdocker compose -p wedding-smoke-standalone --env-file .env.ci -f docker-compose.yml -f docker-compose.ci.yml down -vat startup and cleanup so isolated smoke volumes are torn down while preserving default localdb_dataanduploads_datavolumes; whenDATABASE_URLis set explicitly, it skips starting or tearing down the isolated database container and targets that URL directly.OCI Container Smoke Test:
bashnpm run test:containerRuns
scripts/test-container.mjs+scripts/smoke-runner.mjswith.env.cianddocker-compose.ci.ymlto build the production Docker container, execute the containerizedmigrationservice (docker compose -p wedding-smoke-container --env-file .env.ci -f docker-compose.yml -f docker-compose.ci.yml run --rm migration) by default even whennode_modules/.bin/prismaexists on the host, and verify schema readiness, static assets, authenticated data-backed routes, worker-based HEIC photo upload transcoding,pg.Poolconnection bounds, unauthenticated/guest/loginredaction (Guest Sign-In | Wedding Website), and authenticatedSIGTERMdraining (143).Note:
npm run test:containerselects free loopbackPORTandDB_PORTvalues (honoringTEST_PORTandDB_PORToverrides without killing existing processes on port3000) and executesdocker compose -p wedding-smoke-container --env-file .env.ci -f docker-compose.yml -f docker-compose.ci.yml down -vat startup and cleanup, isolating smoke containers and volumes so default localdb_dataanduploads_datavolumes remain untouched.Static Repository & Document Checks:
bashnpm run check:staticExecutes the shared static verification list in scripts/check-quality.ts (
--static), matching theverifyjob in .github/workflows/ci.yml. For local environment setup, Git hooks (.githooks/pre-commitand.githooks/pre-push), and generated doc-sync rules, see the Developer Setup Guide and Contribution Guidelines.PostgreSQL Migration Drift Verification (
Verify Prisma Migration Sync):bashPOSTGRES_URL_NON_POOLING="postgresql://wedding:wedding123@localhost:5432/wedding_shadow?schema=public" \ npx prisma migrate diff --from-migrations prisma/migrations --to-schema prisma/schema.prisma --exit-codeMirrors the
Verify Prisma Migration SyncCI gate in theunit-testjob of .github/workflows/ci.yml, replayingprisma/migrations/against an isolatedwedding_shadowPostgreSQL database bound via prisma.config.ts (shadowDatabaseUrl). Ensurewedding_shadowexists on your local PostgreSQL container (docker compose --env-file .env.ci -f docker-compose.yml -f docker-compose.ci.yml exec -T db psql -U wedding -d postgres -c 'CREATE DATABASE wedding_shadow;'), and runnpm run migrate:devto generate and commit forward-only SQL migrations whenever schema drift is detected (exit code2).Storybook Static Showcase Build & Subpath Runtime/A11y Audit:
bashNEXT_PUBLIC_BASE_PATH="/wedding_website/storybook" npm run build-storybook NEXT_PUBLIC_BASE_PATH="/wedding_website/storybook" npm run test:a11y:storybookCompiles component stories (
src/**/*.stories.tsx), Storybook configuration (.storybook/main.ts, .storybook/preview.tsx), and MSW mock handlers (src/mocks/handlers.ts) via Webpack 5 withNEXT_PUBLIC_BASE_PATHsubpath injection, then servesstorybook-static/over loopback via scripts/serve-static-export.mjs and executes e2e/storybook/storybook-showcase.audit.ts (playwright.storybook.config.ts,npm run test:e2e:storybook, isolating failure traces undertest-results/playwright-storybook/withtrace: 'retain-on-failure') across all43stories inlightanddarkthemes (86renders), matching the reusable .github/workflows/storybook.yml workflow (workflow_callinvoked bystorybook-buildin .github/workflows/ci.yml receivingneeds.verify.outputs.storybook_base_path, plus manualworkflow_dispatchresolving base paths via scripts/build-pages-bundle.mjs, installing dependencies withnpm ci --ignore-scripts, keyingactions/cacheon the resolved Pages subpath, uploadingstorybook-a11y-violationsonif: always() && !cancelled()andplaywright-storybook-tracesonif: failure(), generating and verifyingstorybook-static/SHA256SUMSvia scripts/release-integrity.sh before uploadingstorybook-static, and running checkout-freeattest-storybookon manual dispatches). Usenpm run storybookfor interactive component development.Static HTML Showcase Build & Subpath Runtime/A11y Audit:
bashNEXT_PUBLIC_BASE_PATH="/wedding_website/demo" npm run build:export NEXT_PUBLIC_BASE_PATH="/wedding_website/demo" npm run test:e2e:staticCompiles the database-free static HTML showcase (
output: 'export') inside.next/export-stagewithoutsrc/app/api(scripts/build-export.mjs), isolating export build caches in.next-export/cache(next.config.ts) while preservingsrc/app/apiand.next/standalonein the repository root, then servesout/over loopback via scripts/serve-static-export.mjs and executes e2e/static/static-showcase.audit.ts (playwright.static.config.ts, isolating failure traces undertest-results/playwright-static/withtrace: 'retain-on-failure') across every exported subpath route in light and dark themes, matching thestatic-export-buildCI job in .github/workflows/ci.yml (uploadingplaywright-static-traceswithretention-days: 7onif: failure()) that feedspages-verify,ci-complete,prepare-docs, anddeploy-docs.Unified GitHub Pages Bundle Verification:
bashPAGES_BASE_PATH=/wedding_website/ npm run pages:build PAGES_BASE_PATH=/wedding_website/ npm run pages:verifyAssembles the VitePress documentation portal (
docs-portal/.vitepress/dist/), interactive static demo (docs-portal/.vitepress/dist/demo/), and Storybook showcase (docs-portal/.vitepress/dist/storybook/) with.nojekyllvia scripts/build-pages-bundle.mjs, then runs all 4 unified bundle browser and cross-app navigation tests in e2e/pages-showcase.spec.ts parameterized byPAGES_BASE_PATH(such as/,/wedding_website/, or/<repo>/, including mountediframe#storybook-preview-iframe#storybook-rootand@axe-core/playwrightverification on/storybook/) with zero skips, matching thepages-verifyCI job (npm ci --ignore-scripts, receivingPAGES_BASE_PATHfromneeds.verify.outputs.portal_base_path) in .github/workflows/ci.yml that uploadspages-bundleand joins the read-onlyci-completeterminal check in gatingprepare-docsanddeploy-docs.Complete Quality Gate:
bashnpm run quality # or npm run check:allRuns the full sequential suite in scripts/check-quality.ts — including static verifications, TypeScript and linter passes, documentation portal, Storybook, and static HTML showcase builds (
npm run docs:build,npm run build-storybook,npm run build:export), and full-coverage unit/integration tests (npm run test:cov) — prior to pushing (see also AGENTS.md).
Writing New Tests
When contributing new functionality:
- Feature Co-location: Place tests in a
__tests__directory adjacent to the feature, component, or utility being introduced. - User-Centric Component Tests: Use React Testing Library to test behavior from an end-user or accessibility perspective, avoiding reliance on internal component implementation details.
- Database Operations: Leverage the isolated test database environment. Do not hardcode production or development credentials in test files.
- Maintain Coverage: Ensure new code includes sufficient unit and integration test coverage to uphold the global threshold standards (80% lines, 68% branches).