-
Notifications
You must be signed in to change notification settings - Fork 0
23 Donation e2e integration and controller unit testing #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…recognize tests in /test folder
…-module' into 23-Donation-E2E-integration-testing
… into donation.spec.ts
|
Looks like typeORM doesn't return the dates until they're like fully created in the DB and the object returned by saved doesn't include those dates that are defaulted to now() as specified in the migration. I made a potential fix by returning an object found through findOne (which gets the object after it's fully made in the db) but that could lead to worst performance at large scale because it's giving an extra query for info that may not be necessary |
Description
More Donation Controller Unit tests for the POST /api/donations, GET /api/donations/public, and GET /api/donations/stats endpoints
Donation e2e integration tests for the POST /api/donations, GET /api/donations/public, and GET /api/donations/stats endpoints
Testing & Verification
E2E integration tests:
Smoke test to validate test setup
More tests for Donation integration tests (with mocks)
4. POST /api/donations - validation errors:
5. Negative amount returns 400
6. Invalid email format returns 400
7. Donation marked recurring without a specified interval returns 400
8. One-time with interval returns 400
9. Throws 500 if the database errors
10. Rejects with missing first name
11. Rejects with missing last name
12. Rejects with missing email
13. Rejects with missing amount
14. Accepts if isAnonymous is missing
15. Rejects with missing donationType
16. Rejects with invalid recurring
17. Rejects with invalid donationType
18. GET /api/donations/public - returns only non-anonymous donations
19. Returns no donations if there are none in the db
21. Throws if db does
22. Returns with correct DTO
23. GET /api/donations/stats - returns correct total and count
24. Returns correct total and count even with empty db
25. throws if db throws
Related Issues
Closes #23