Description
This task should cover, at least for now, enough test cases for all existing endpoints of the instrument controller in the backend. At this time it's where most of the functionality resides.
At this moment there is already a branch (https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/tree/integration-tests?ref_type=heads) where a few integration test cases are done and working fine. That should be the starting point for this task. These test can be run with npm run integration-test.
Existing integration test cases have been created with chai library and, at this moment, they only can be run locally because the pipeline is not ready to run them. At the Notes section there is a nice-to-have proposal to fix that.
Acceptance criteria
- There is integration test case for GET /instruments [200 OK]
- There is integration test case for GET /api/v1/instruments [200 OK]
- There is integration test case for GET /instrument/:slug [200 OK, 404 Not Found]
- There is integration test case for POST /instruments [201 Created, 400 Bad Request, 409 Conflict]
- There is integration test case for PUT /instrument/:slug [200 OK, 400 Bad Request]
- There is integration test case for DELETE /instrument/:id [200 OK]
- There is integration test case for PATCH /instrument/:id to enable/disable [200 OK]
Required
- TBD?
Notes
A nice to have here would be to include a MariaDBservice in the GitLab pipeline to be able to run these tests using the pipeline. Some details at https://docs.gitlab.com/ee/ci/services/