forked from Code-4-Community/scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary:
Write integration tests that verify the complete donation flow from HTTP request through service layer to database persistence. Test all endpoints and error scenarios.
Files to create:
apps/backend/test/donations.e2e-spec.ts
Test scenarios:
- POST /api/donations - successful one-time donation creation
- POST /api/donations - successful recurring donation with interval
- POST /api/donations - validation errors:
- Negative amount returns 400
- Invalid email format returns 400
- Recurring without interval returns 400
- One-time with interval returns 400
- GET /api/donations/public - returns only non-anonymous donations
- GET /api/donations/stats - returns correct total and count
Acceptance criteria:
- Tests use real database (test database or in-memory SQLite)
- All endpoints return correct status codes
- Response bodies match expected DTO shapes
- Database state verified after POST operations
- Tests clean up after themselves (transactions or teardown)
Notes:
Use supertest for HTTP testing and NestJS Test.createTestingModule(). Reference existing test patterns in the repo. Each test should be independent.
Metadata
Metadata
Assignees
Labels
No labels