-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Changes <!-- example: - Fixes wrong color in button - Adds a new page --> - adds `test` and `unit-test` scripts - adds unit tests for `i18n` lib function - adds a `vitest.config.ts` so we can configure the testing suite - adds new deps needed for testing - adds `unit-tests` step to github action CI so we test each commit to the repo from now on - uses the `github actions reporter` to enable formatting and highlighting of testing output in the CI pipeline - adds documentation for testing setup - fixes the following issues in the i18n lib function: - interpolation did not work in the `t` function - params and language props were not supported in `t` function # Associated issue Part of #103 # How to test - verify that the tests in the CI were succesful # Checklist - [x] I have performed a self-review of my own code - [x] I have made sure that my PR is easy to review (not too big, includes comments) - [x] I have made updated relevant documentation files (in project README, docs/, etc) - [x] I have added a decision log entry if the change affects the architecture or changes a significant technology - [x] I have notified a reviewer <!-- Please strike through and check off all items that do not apply (rather than removing them) -->
- Loading branch information
1 parent
1e86960
commit 088be88
Showing
8 changed files
with
673 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Testing | ||
|
||
Head Start utilises testing to ensure the quality of the codebase and to prevent regressions. This helps developers to build with confidence which is especially important with a project that is developed and maintained by multiple developers. The CI pipeline will run the tests automatically on every push to the repository. | ||
|
||
We use [vitest](https://vitest.dev/) to run our tests. Vitests is configurable through its config (vitest.config.ts) and automatically finds test files to run if they follow the `<filename>.test.ts` naming convention. | ||
|
||
## Unit Testing | ||
|
||
We use unit testing to test individual library functions and components. Our setup uses `vitest` for running test and [msw](https://mswjs.io/) for mocking network requests. | ||
|
||
You can run the unit tests with the following command: | ||
|
||
```bash | ||
npm run test:unit | ||
``` | ||
|
||
NOTE: not all unit test have been added at the time of writing this. | ||
|
||
## e2e Testing | ||
|
||
We plan to add this in the future. | ||
|
Oops, something went wrong.