Integration Test Scaffolder
When to Trigger
- •API route created
- •Database operations
- •External service integration
What to Do
- •Setup: beforeAll/afterAll for DB (e.g. test DB or transaction rollback); beforeEach to reset data if needed.
- •Client: Use test client (e.g. supertest or project helper) to hit app routes; support auth (e.g. as('admin')).
- •Cases: Happy path (201/200, body shape); validation (400); auth (401/403); not found (404); conflict/duplicate where relevant.
- •Assert: Status, response shape, and optionally DB state (e.g. prisma.booking.findUnique).
Place in tests/integration/ or similar. Use factories for test data. Keep tests independent and order-independent.