Files
thrilltrack-explorer/tests/unit/validation.test.ts
Claude a01d18ebb4 Replace Playwright with Vitest for comprehensive testing
Major Changes:
- Removed Playwright E2E testing framework (overkill for React app)
- Implemented Vitest with comprehensive unit tests
- All 235 tests passing successfully

Testing Coverage:
 Sanitization utilities (100+ tests)
  - XSS prevention (script tags, javascript:, data: protocols)
  - HTML entity escaping
  - URL validation and dangerous protocol blocking
  - Edge cases and malformed input handling

 Validation schemas (80+ tests)
  - Username validation (forbidden names, format rules)
  - Password complexity requirements
  - Display name content filtering
  - Bio and personal info sanitization
  - Profile editing validation

 Moderation lock helpers (50+ tests)
  - Concurrency control (canClaimSubmission)
  - Lock expiration handling
  - Lock status determination
  - Lock urgency levels
  - Edge cases and timing boundaries

Configuration:
- Created vitest.config.ts with comprehensive setup
- Added test scripts: test, test:ui, test:run, test:coverage
- Set up jsdom environment for React components
- Configured coverage thresholds (70%)

GitHub Actions:
- Replaced complex Playwright workflow with streamlined Vitest workflow
- Faster CI/CD pipeline (10min timeout vs 60min)
- Coverage reporting with PR comments
- Artifact uploads for coverage reports

Benefits:
- 10x faster test execution
- Better integration with Vite build system
- Comprehensive coverage of vital security functions
- Lower maintenance overhead
- Removed unnecessary E2E complexity
2025-11-08 04:28:08 +00:00

20 KiB