Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Adds Jest framework to test the frontend
yarn test
for jest suiteyarn test:update
to update snapshots for large UI changesyarn coverage
to generate a coverage reportWe will go with the structure of
src/{folder}/__tests__
for each folder to keep the tests close to their componentssrc/{folder}/{sub_folder}/__tests__
for sub folders that are largeSnapshot tests of current pages added
Github actions added to run test suite and generate coverage report (report not yet placed as a badge%)
Deletes some unneeded imports for user page (sry the lint keeps nagging)
Dependencies added to dev:
Jest
, its typescript modules and environmentstesting-library/react
andtesting-library/jest-dom
ts-node
Related Issue(s)
#27 , may close after some tests written for components, helpers and utilities
Additional Notes/References
You may need to run
yarn upgrade
as there are issues withyarn
andjest
according to this.I solved this issue in the github actions by adding the fix:
"resolutions": { "wrap-ansi": "7.0.0", "string-width": "4.1.0" }
but any side effects from this is unknown
I'll write a quick cheat sheet for jest on frontend later
There is a console log in
dateUtils.ts
that is caught in this test lol