Skip to content

Conversation

@rudrikasharma15
Copy link

Added Unit Test for GET /api/users Route
This PR adds a Jest-based unit test for the GET /api/users route using supertest.
It mocks the userService.getUsers() method to ensure the controller behaves correctly.

Changes made:
Added a test in server/test/controller/User.test.js

Used jest.spyOn to mock service call

Verified response body and status code

Notes:
Confirmed the test passes (npm test)
Set up Jest + Supertest locally

Happy to add more test cases or refactor based on feedback! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant