LaWallet NWC
Guides

Testing Strategy

Testing pyramid with Vitest, MSW, React Testing Library, and Playwright.

Testing Pyramid

LayerToolScopeTarget Coverage
UnitVitestHooks, utilities, SDK methods80%
ComponentReact Testing Library + VitestUI components, hooks integration70%
APIMSW + VitestAPI routes, middleware, auth90%
IntegrationVitest + Prisma test utilsDB ops, NWC flows, redirect resolution70%
E2EPlaywrightMulti-browser flows, visual regressionCritical paths
CoverageVitest Coverage (c8/v8)Overall codebase70% minimum

Unit Testing (Vitest)

  • Primary test runner for all unit and integration tests
  • React Testing Library with happy-dom environment
  • Coverage reporting via c8/v8
  • Target: 80% on hooks and utilities

Component Testing (React Testing Library + Vitest)

  • Test UI components in isolation
  • Verify hook integration with components
  • Test user interactions and state changes
  • Target: 70% on component library

API Testing (MSW)

  • Mock Service Worker for API route mocking
  • Test NWC connection, lightning address, auth endpoints
  • Simulate payment callbacks
  • Test error handling and edge cases
  • Target: 90% on API routes

Integration Testing (Prisma Test Utils)

  • Isolated test database per test suite
  • Seeding scripts for reproducible test data
  • Transaction rollback between tests
  • Test NWC flows, alias/redirect resolution, address lifecycle
  • Target: 70% on integration paths

E2E Testing (Playwright)

Multi-browser

  • Chrome, Firefox, Safari
  • Run against reimplemented components from month 3 onward
  • Visual regression baselines and updates

Timeline

MonthScope
3Multi-browser smoke tests, visual regression baseline, admin dashboard flows, alias setup
4User dashboard, profile/npub setup, redirect/NWC flows, visual regression updates
5Lightning compliance flows, webhook delivery, redirect resolution
6Deployment smoke tests, full regression across all 3 services

CI/CD Integration

  • GitHub Actions workflow: lint → typecheck → test
  • PR status checks required for merge
  • Branch protection on main
  • Coverage upload to Codecov
  • Automated build verification on push

On this page