Use global setup/teardown of test database, add student endpoint tests #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes the next round of progress on setting up our test suite. The main improvement here is to move the database setup and teardown into Jest's
globalSetup
andglobalTeardown
. The global setup/teardown completely bookend the execution of any of the test files. Note that we can't export global variables out of these, and that's fine - we can set a client up in each test file. This PR also adds a couple tests of the student endpoints. Note that each of these tests destroys any resources that it creates in the database. I think this is generally a good pattern - the only things that we want to keep around between tests are things like an "API key" for authorization, as that's independent of any particular test logic.