Unit tests
Currently we have only written Unit Tests for our Frontend Web App. Please ensure you are within your Frontend project directory in terminal/cmd before proceeding.
Writing unit tests is recommended for any new features or logic that you develop.
Whilst we are primarily using 'Jest' (framework from Facebook), to write our unit tests we are using a number of other libraries for testing. Please see the 'package.json' file for more information.
We are currently writing tests for the following:
There are two commands you can use to run tests.
    yarn run test OR npm run test
    This will run your initial tests.
    yarn run test-coverage OR npm run test-coverage
    Shows test coverage across our application.
Please note: not all code within our project requires testing or is testable.
Test file Structure
All unit tests are housed within the 'Frontend/src/__test__' directory. We have replicated the same file structure as our main application, however test files have '.test' appended to them.
When should I run these tests?
You should run these unit tests before pushing any work to a remote branch. Please do not approve any PR’s into the dev branch without the proper unit tests having been written.
In the event a test fails, please ensure any relevant errors are resolved prior to committing the changes or creating a new PR.
Last modified 3yr ago
Copy link