I have a simple question for people who use react-native and Expo.
I am using the following technologies
- Styled-components
- react-native-paper
- Context API (for Authentication)
I am new to testing in Jest/Testing-library but I want to know how to start testing my app.
I have specific question which is :
How to test the functions that reside inside Context Provider?
I have functions such as RegisterValidation (checks username and password patterns) Register
I React states such as isLoading and error
I have been trying for 2 days but did not find a real solution.
What I did Until Now:
I installed jest-expo and did some configurations
I tried to test the functions directly but got an error due to useState
I tried to test through a child component but an error like this
TypeError: Cannot read properties of undefined (reading 'onRegister')
31 | });
> 32 | const { onRegister, isLoading, error } = useContext(AuthContext);
I have been dealing with some error with styled-components as well
I do not know where to start and what to do now.