tdm-calculator icon indicating copy to clipboard operation
tdm-calculator copied to clipboard

Implement Web API tests for /api/feedbacks

Open agosmou opened this issue 1 year ago • 2 comments

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/

agosmou avatar Feb 15 '24 02:02 agosmou

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)

agosmou avatar Feb 15 '24 02:02 agosmou

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

agosmou avatar Feb 15 '24 04:02 agosmou

@WomB0ComB0 Please provide update

  1. Progress: "What is the current status of your project? What have you completed and what is left to do?"
  2. Blockers: "Difficulties or errors encountered."
  3. Availability: "How much time will you have this week to work on this issue?"
  4. ETA: "When do you expect this issue to be completed?"
  5. 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 avatar Jun 13 '24 20:06 ExperimentsInHonesty

@ExperimentsInHonesty

  1. 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.
  2. Getting the tests to run on everyone's machines
  3. I am done, I need to have it run on everyone who was involved in machines.
  4. I am done.

WomB0ComB0 avatar Jun 13 '24 22:06 WomB0ComB0