23 Donation e2e integration and controller unit testing#28
Merged
Conversation
…recognize tests in /test folder
…-module' into 23-Donation-E2E-integration-testing
… into donation.spec.ts
Contributor
Author
|
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 |
thaninbew
approved these changes
Nov 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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