TechAndCheck / tech-and-check-alerts

Daily tip sheet for fact checkers
MIT License
13 stars 6 forks source link

Add support for a test database #321

Closed slifty closed 4 years ago

slifty commented 4 years ago

This adds in the pipework to allow our tests to interact with a database.

It migrates the test database when tests are run, adds Travis support for postgres, adds some protection to make sure tests are never run on a production / dev database, and also fixes an issue with database connections that became a blocker after enabling the test DB on CI.

This does not look like a week of work but there was a big struggle / rabbit hole as outlined in this SO issue

To test this PR

Just run tests. (yarn test)

Extra Setup

You will probably find that you need to update your environment variables so that your test DB is different from your prod / dev DB. Since we weren't using test DB in the past it's likely that they were all pointing to the same place.

Resolves Issue #317