Add unit tests for GetGoalsForUser route in GoalController#266
Add unit tests for GetGoalsForUser route in GoalController#266malaikahunain wants to merge 2 commits into
Conversation
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| - | - | MongoDB Credentials | 781690b | CommBank-Server/appsettings.json | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Summary
This PR adds unit test coverage for the
GetForUser(GetGoalsForUser) route inGoalController, using the xUnit testing framework.Background
As part of the icon feature work, the Goal model was extended with an optional
Iconfield, and the backend/frontend were wired together so that icon changes persist via a PUT request. Before landing these changes, test coverage was needed to verify theGetGoalsForUserendpoint behaves correctly.Changes Made
[Fact]test methodGetForUser()inCommBank.Tests/GoalControllerTests.csFakeCollections,FakeGoalsService, andFakeUsersServicecontroller.GetForUser(userId)to fetch goals for a specific userGoalUserIdmatches the expected userTesting
All tests pass locally:
Passed! - Failed: 0, Passed: 9, Skipped: 0, Total: 9
Notes
No other files were changed in this PR — only test coverage was added.