Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Latest commit

 

History

History
17 lines (10 loc) · 1.13 KB

unit.md

File metadata and controls

17 lines (10 loc) · 1.13 KB

Table of contents / Testing

Unit tests

We use Jest for our unit testing needs. To run Jest in watch mode locally so the tests run automatically while you're developing run:

yarn run test

Before running the tests this will set up a RethinkDB database locally called "testing". It will run the migrations over it and then insert some dummy data. This is important because we test our GraphQL API against the real database, we don't mock anything, to make sure everything is working 100%.

When you exit the testing process with CTRL+C it will clean the database from all its data. It leaves the migrations in tact though, since there's no reason we should have to run them everytime we run the test suite.

Stale data

In edge cases it could happen that you end up with bad data locally and that tests fail/pass even though they shouldn't. To get rid of the stale data just stop the testing process and optionally run yarn run posttest to make extra sure there's nothing in the database anymore, before restarting the testing process to start from a clean slate.