| name | react-component-testing |
| description | Test React components with Testing Library — render, query by role, and assert on user-visible behavior. |
| version | 1.2.0 |
| tags | ["react","testing","frontend"] |
| status | active |
React Component Testing
Test what the user sees, not implementation details.
render(<Component />) from @testing-library/react.
- Query by accessible role:
screen.getByRole('button', { name: /save/i }).
- Drive interactions with
userEvent, then assert on the resulting DOM.
- Avoid
container.querySelector and snapshot-everything tests — they break on refactors.
Prefer findBy* for async UI and getBy* for content that is already present.