Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Unit Tests

Guntbert Reiter edited this page Oct 7, 2017 · 5 revisions

Running tests locally

After setting up your local environment for the app, you can run all tests with Mocha from the project root.

Some of the tests interact with remote services directly, so you will have to add your API keys to your environment when running the test suite.

DARK_SKY_API_KEY=<key> GOOGLE_API_KEY=<key> npm test

Alternatively you can add the following lines to your ~/.bashrc file:

export DARK_SKY_API_KEY=<key>
export GOOGLE_API_KEY=<key>

Apply these settings to the current session if necessary:

source ~/.bashrc

Then the test script will always use those keys and you can simply type:

npm test

Accessibility tests

For automated accessibility testing, the project uses tenon.io. Since this is a paid service, you are not obliged to obtain an API key for local development. The corresponding checks will be skipped if there is no key present.

Tenon.io tests are run during the build after you create a pull request. If you happen to have access to the tenon.io API and want to test locally, add the key to your environment with TENON_API_KEY=.