-
-
Notifications
You must be signed in to change notification settings - Fork 62
Description
#70 added a bunch of tests for the routes, but it only tests the happy path (what's supposed to happen). We need "negative" unit tests that test that the app fails gracefully and as expected based on bogus input. In those situations where HTML is returned instead of JSON, or the api returns a 500 instead of a 400 series error, the route should be modified such that it will return the expected/required input. When someone puts in a PR for a negative unit test that requires a change of behavior, we can discuss in that PR what the exact behavior we want ought to be.
Acceptance criteria:
Each route should have a few negative unit tests with bogus input. The test should verify that JSON is returned (preferably with a helpful error message). The API should never return HTML, so unit tests should verify a valid JSON response. No error should leak any information about our database. The HTTP status code returned should be as specific as possible (e.g., a 422 is favored over a 400 when invalid input is returned).