aws-amplify / aws-amplify/docs

Testing components with react-test-library

Open
#2,832 3 comments 7 reactions 0 assignees View on GitHub
amplify/js feature-request guides
Dominant language
MDX
Stars
506
Forks
1.1k
Avg merge
3h 14m
Merged PRs (30d)
1

Description

It would be great to have some documentation on using Amplify with [react-testing-library (RTL)](https://testing-library.com/docs/react-testing-library/intro/). RTL has 13k+ stars on github and is now the recommended library to use when testing react components.

As a start i think it would be good to have some examples on testing Amplify UI components and components that use an Amplify API. Where we can mock the API service with JEST, so we can test them.

Maybe it could be a stage of the [React - Getting started guide](https://docs.amplify.aws/start/q/integration/react)? Which has an API as well as Amplify UI components

There is documentation on Mocking Amplify services using `amplify mock` and how to set up end-to-end tests but i think that leaves a gap of how to perform fast unit tests which can be run in a CI environment.

Would love to hear further thoughts and recommendations.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.