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
42 stars 115 forks source link

[Feat] Write Test Cases for `/hospitalapi` Routes #487

Open Abhi0049k opened 3 hours ago

Abhi0049k commented 3 hours ago

Is there an existing issue for this?

Feature Description

The following /hospitalapi 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 / - createHospital

    • Test for creating a hospital with valid data.
    • Test for validation errors when missing or invalid data is provided.
  2. GET / - searchHospitalByQuery

    • Test for retrieving hospitals based on search criteria.
    • Test for handling no results found and invalid query parameters.
  3. GET /:id - getHospitalByID

    • Test for retrieving a hospital by ID.
    • Test for handling invalid or non-existing IDs.
  4. PATCH /:id (Protected) - updateHospitalByID

    • Test for successfully updating a hospital's information by ID with valid data.
    • Test for handling unauthorized access and invalid data.
  5. DELETE /:id (Protected) - deleteHospitalByID

    • Test for successfully deleting a hospital by ID.
    • Test for handling unauthorized access and non-existing IDs.

Expected Outcome:

Use Case

Adding these test cases will enhance the project by ensuring the /hospitalapi routes function correctly and reliably. This will help maintain the integrity of the API as changes are made and reduce the potential for regressions.

Benefits

Priority

High

Record

Abhi0049k commented 3 hours ago

Hi @Luson045, I would like to work on this issue, please assign me this issue.