tdm-calculator
tdm-calculator copied to clipboard
Implement Web API tests for /api/feedbacks
Overview
We need to create a workflow for testing all 'Feedback' endpoints. We will need to set up tests and web API request validation for the endpoints.
Details | Scope of Work
We need to test the API endpoints using 'jest'
Action Items
- [ ] write all tests for endpoints
- [ ] set up server side validation schema (this should be done for the POST requests that contain a body - we validate the body data)
Resources/Instructions
TDM Testing
- Testing Wiki
- Check existing tests and build your tests to match what is in the codebase
Server Side Validation
- https://www.npmjs.com/package/express-json-validator-middleware
- https://simonplend.com/how-to-handle-request-validation-in-your-express-api/
Testing
- https://jestjs.io/
- https://testcontainers.com/
Here's a PR submitted that can be used to model your implementation
- make sure you test your code in the test environment and as the end user (ie by manually going through the feedback items on the browser to make sure it would work for the end user)
Additionally, make sure you mock out the sendgrid-service.js so that your tests dont send out any actual emails by engaging a 3rd party API
You can copy the scaffolding for this from account.test.js
@WomB0ComB0 Please provide update
- Progress: "What is the current status of your project? What have you completed and what is left to do?"
- Blockers: "Difficulties or errors encountered."
- Availability: "How much time will you have this week to work on this issue?"
- ETA: "When do you expect this issue to be completed?"
- Pictures or links* (if necessary): "Add any pictures or links that will help illustrate what you are working on."
- remember to add links to the top of the issue if they are going to be needed again.
@ExperimentsInHonesty
- The current status of the issue is, 'incomplete', we had to get the tests running on everyone's machines. However, my only task was to write the tests and schema validation for this particular issue.
- Getting the tests to run on everyone's machines
- I am done, I need to have it run on everyone who was involved in machines.
- I am done.