Integration Tests for an API Route
Cover the success path, validation, auth failures, 404s, and side effects of one endpoint.
Intermediate1 min read
Customize
Fill these in and the prompt below updates as you type. Anything you leave blank stays as a placeholder.
Your prompt
3 placeholders leftWrite integration tests for this {{framework}} route using {{test_stack}}. Test: - Successful response (correct status code and response shape) - Validation errors (missing or invalid fields) - Authentication/authorization failures - Resource not found - Any side effects (e.g. email sent, DB record created) Mock the database and any external services. Use beforeEach/afterEach for setup and teardown. Route handler: {{code}}