Description
We will perform spec validation against actual endpoint behavior as part of the CI pipeline process. To do that, we will use a reusable Javascript method to compare the response bodies of the defined spec against the actual endpoint.
Problem statement
We need a consistent way to validate response bodies as part of end-to-end endpoint testing. Although we will still need to call this method from within end-to-end testing for every endpoint, creating a reusable validation method will allow us to maintain the logic from a single location instead of writing bespoke validation checks for each endpoint.
Conditions of acceptance
[] Implement a reusable method that will accept two versions of the responses and confirm whether they match or not.
[] If they do not match, return helpful information about what failed. Examples include:
. [] New property found on endpoint response.
. [] Defined property missing from endpoint response.
. [] HTTP status code mismatch, or status code is not defined.
Note: The above is crossed out because chai-openapi-response-validator ended up satisfying the need and providing suitable errors without as much coding on our part.
Dependencies
Assumes the following work is complete:
Out of scope
This work does not include implementing the tests within Mocha. That will be covered in a separate ticket.