Automated Testing

Updated February 23, 2026

The admin panel includes a comprehensive automated testing suite that validates all business logic, API integrations, and UI components.

Overview

MetricValue
Total tests564
Test files42
Test runnerVitest
API mockingMSW (Mock Service Worker)
Component testingReact Testing Library

Running Tests

All commands are executed inside the Docker container.

CommandDescription
docker exec booking_admin_dev npx vitest runRun all tests once
docker exec booking_admin_dev npx vitestRun in watch mode
docker exec booking_admin_dev npm run test:coverageRun 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:

  1. Create a test file next to the source file (e.g., useBookings.test.ts)
  2. Add MSW handlers in src/test/handlers.ts for any new API endpoints
  3. Add factory functions in src/test/factories.ts for new entity types
  4. 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

Related