Tweet-311-Denver / tweet_311_denver_service

Backend for Tweet311Denver Turing Project
MIT License
1 stars 0 forks source link

Endpoint Testing and error handling #35

Closed Dustin-Mikusko closed 4 years ago

Dustin-Mikusko commented 4 years ago

What does this PR do?

This PR adds in error handling try/catch code to the reports endpoints, to check for server errors and requiredParameters as needed in the request payload. It also implements tests for the endpoints.

Where should the reviewer start?

The new reports.test.js file contains the new tests.

Background Info

I installed Sinon to mock the Puppeteer functionality. Run npm install sinon to get that installed. That allowed the POST test to pass (for a time). That test is currently failing, and I'm not sure why. The functionality is still working perfectly, as I tested that in Postman. I ran two migrations to add a CASCADE delete functionality on the reports table. Run knex migrate:latest and knex migrate:latest --env=test to get up to speed with those new migrations.

Issues Closed

Closes #30 Closes #34