crisisboard / opencrisisboard

OpenCrisisBoard (OCB) is an open-source, self-hosted communications board where communities can organize around local information
https://opencrisisboard.org/
MIT License
48 stars 17 forks source link

Install unit test framework for backend, write first few unit tests #11

Open aPruner opened 4 years ago

aPruner commented 4 years ago

Our backend is also in need of unit tests. Let's install a test framework so we can test our api routes, utilities, and other backend functions.

I recommend that we (like the frontend) use Jest so we have a common test environment on both ends of the app. We can also use Supertest for our endpoint-specific tests.

Here's a guide that might be helpful in getting started on this one: https://dev.to/nedsoft/testing-nodejs-express-api-with-jest-and-supertest-1km6