Skip to content

Commit

Permalink
Add a guide for testing with Jest
Browse files Browse the repository at this point in the history
Borrowed from the thoughtbot guides with some removals that suite our
style.
  • Loading branch information
dgalarza committed Jan 12, 2023
1 parent cb3ee97 commit af8822e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ do not cover your particular topic, review their guides for guidance.
- [Rails](rails/README.md)
- [React](react/README.md)
- [Testing with RSpec](testing-rspec/README.md)
- [Testing with Jest](testing-jest/README.md)

## Protocols

Expand Down
19 changes: 19 additions & 0 deletions testing-jest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Testing with Jest

- Use [eslint-plugin-jest] to enforce testing style
- Use [@testing-library/jest-dom] for supplemental expectation matchers
- Use [React Testing Library] for testing [React](/react/) components
- Use [React Hooks Testing Library] for testing [React Hooks]
- Use [User Event] for simulating DOM events on React components under test
- Use [Fishery] for building factories
- Prefer writing specific unit tests over [Snapshot Testing]
- Prefer `describe` and `it` blocks over `test` blocks

[eslint-plugin-jest]: https://github.com/jest-community/eslint-plugin-jest
[testing-library/jest-dom]: https://github.com/testing-library/jest-dom
[react testing library]: https://github.com/testing-library/react-testing-library
[react hooks testing library]: https://github.com/testing-library/react-hooks-testing-library
[react hooks]: https://reactjs.org/docs/hooks-overview.html
[user event]: https://github.com/testing-library/user-event
[fishery]: https://github.com/thoughtbot/fishery
[snapshot testing]: https://jestjs.io/docs/en/snapshot-testing

0 comments on commit af8822e

Please sign in to comment.