Skip to content

Testing

Testing guidelines for Booking Platform

Test Types

Unit Tests

bash
bun test

Uses Vitest for unit testing

typescript
import { describe, it, expect } from 'vitest';

describe('Booking', () => {
  it('should create booking', () => {
    const booking = createBooking({ serviceId: 'svc_1' });
    expect(booking.id).toBeDefined();
  });
});

Integration Tests

bash
bun test --filter integration

E2E Tests

bash
bun run test:e2e

Uses Playwright for E2E testing

typescript
import { test, expect } from '@playwright/test';

test('user can book appointment', async ({ page }) => {
  await page.goto('/provider/123');
  await page.click('text=Book Now');
  await page.fill('input[name=name]', 'John Doe');
  await page.click('text=Confirm');
  await expect(page.locator('text=Booking Successful')).toBeVisible();
});

Running Tests

bash
# Run all
bun run verify

# Run lint
bun run lint

# Run typecheck
bun run typecheck

# Run tests
bun run test

# Run tests in watch mode
bun run test:watch

Coverage

bash
bun run test:coverage

Target 100% coverage for:

  • Business logic
  • API handlers
  • Database queries

API Testing

bash
# Run API tests
bun test --filter api

See API Tester for interactive API testing


Released under the MIT License.