bcgov / digital_marketplace

The intent of this development is to build a product that will support digital procurement needs for the BC Government including services such as, but not limited to, Sprint With Us, Code With Us, The Procurement Concierge.
Apache License 2.0
13 stars 17 forks source link

Dm1135 api integration test harness #376

Closed sutherlanda closed 1 year ago

sutherlanda commented 1 year ago

This adds an integration test harness for the API that leverages jest and an ephemeral PostgreSQL database.

To run the current integration tests, run yarn integration-tests:run. The setup for the environment and launching of the ephemeral database is handled by a bash script scrips/run-integration-tests.sh. This script will launch the dockerized test database, run migrations, export any required environment variables and then launch the integration tests using jest.

Since the database is cleared in between tests, a separate schema digmkt-test is used as the default for the ephemeral database. This is to eliminate any risk of the tests being run against a non-test database, and clearing out data unintentionally.

The full suite of integrations tests has not yet been added, but this should be useful for supporting the development of TWU as well as any refactors/improvements to existing functionality (i.e. email notifications).

Notes: