Luson045 / medi-connect

Medi-connect(now Med Space) is an online hospital appointment booking website. Visit our website, Make sure the check the announcement... LEAVE US A ⭐...
https://med-space.vercel.app/
MIT License
44 stars 136 forks source link

[Feat] Write Test Cases for `/profile` Routes #486

Open Abhi0049k opened 1 week ago

Abhi0049k commented 1 week ago

Is there an existing issue for this?

Feature Description

The following /user routes currently lack proper test coverage. To ensure they behave as expected and to prevent future regressions, we need to write comprehensive test cases that validate all possible scenarios, including success and error cases.

Routes to Cover:

  1. POST / - createUserProfile

    • Test for creating a user profile with valid data.
    • Test for validation errors when missing or invalid data is provided.
  2. POST /:id - getUserByID

    • Test for retrieving a user by ID.
    • Test for handling invalid or non-existing IDs.
  3. POST / (Protected) - getAllUsers

    • Test for retrieving all users when authenticated.
    • Test for handling unauthenticated requests.
  4. POST /:id (Protected) - deleteUserByID

    • Test for successfully deleting a user by ID.
    • Test for handling unauthorized or unauthenticated access.
  5. POST /:id (Protected)- updateUserByID

    • Test for updating a user profile by ID with valid data.
    • Test for handling unauthorized access or invalid data.
  6. GET /profile (Protected) - getProfile

    • Test for retrieving the authenticated user’s profile.
    • Test for handling unauthenticated requests.
  7. PUT /profile/edit/:id (Protected) - editProfileByID

    • Test for successfully editing a user profile by ID.
    • Test for handling unauthorized or invalid update attempts.

Use Case

Adding these test cases will enhance the project by increasing its reliability and maintainability. It will ensure that all the /user routes function as expected, reducing the likelihood of bugs or regressions. Having proper test coverage for these routes will also speed up development and provide confidence when making future changes.

Benefits

Benefits:

Priority

High

Record

Abhi0049k commented 1 week ago

@Luson045, please assign me this issue.