There are current two ways to run tests, using either PostgreSQL or SQLite.
- Install Docker
- Run redis and postgres using docker-compose:
docker-compose up
- Create the test database:
./dev-tools/create-test-database
- Run
yarn test
- Install PostgreSQL - Tips to installing Postgres
- In PostgreSQL, create a database and user named "spoke_test":
CREATE DATABASE spoke_test;
CREATE USER spoke_test WITH PASSWORD 'spoke_test';
GRANT ALL PRIVILEGES ON DATABASE spoke_test TO spoke_test;
- Run
yarn test
- Run
yarn run test-sqlite
Redis is used for caching and is separate from the backend DB so can be used with sqlite or postgres. Redis cache testing defaults to postgres and functions like an 'addon' to the DB for improved speed/scalability.
- Run
yarn test-rediscache
- Run your local development environment with DEFAULT_SERVICE=fakeservice.
- Run
yarn run cypress open
for the interactive test runner. For non-interactive runyarn run cypress run --browser <browser>
.
See the Cypress documentation for more info.