Automated Testing
Ten artykuł jest dostępny po angielsku i ukraińsku. Czytasz wersję angielską.
Zaktualizowano 23 lutego 2026
The admin panel includes a comprehensive automated testing suite that validates all business logic, API integrations, and UI components.
Overview
| Metric | Value |
|---|---|
| Total tests | 564 |
| Test files | 42 |
| Test runner | Vitest |
| API mocking | MSW (Mock Service Worker) |
| Component testing | React Testing Library |
Running Tests
All commands are executed inside the Docker container.
| Command | Description |
|---|---|
docker exec booking_admin_dev npx vitest run | Run all tests once |
docker exec booking_admin_dev npx vitest | Run in watch mode |
docker exec booking_admin_dev npm run test:coverage | Run with coverage report |
What Is Tested
Entity Logic (10 files, ~190 tests)
Status badges, formatting functions, color mappings, and constants for all domain entities: bookings, staff, services, customers, subscriptions, memberships, payments, media, digital products, and schedules.
Utilities (4 files, ~54 tests)
Date/time formatting, timezone conversions, URL helpers, and currency formatting with multi-currency support.
API Hooks (20 files, ~260 tests)
All React Query hooks that fetch and mutate data: list queries, detail queries, create/update/delete mutations, and cache invalidation for every feature module.
UI Components (9 files, ~39 tests)
Status badge components for all entities (correct colors, labels, and styling) and usage progress bars.
Translations (1 file, 5 tests)
Consistency checks ensuring all three locale files (EN, UK, PL) have matching translation keys.
Adding New Tests
When adding a new feature, follow this pattern:
- Create a test file next to the source file (e.g.,
useBookings.test.ts) - Add MSW handlers in
src/test/handlers.tsfor any new API endpoints - Add factory functions in
src/test/factories.tsfor new entity types - Run the specific test:
docker exec booking_admin_dev npx vitest run path/to/file.test.ts
Tip: Run the full test suite before committing to catch regressions:
docker exec booking_admin_dev npx vitest run