Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property nativeEvent of undefined while testing with JEST and react-testing-library #41

Open
Prernabudh opened this issue May 3, 2021 · 3 comments

Comments

@Prernabudh
Copy link

This is my component:
image

I try to simulate on press while testing using react testing library and this is the error I get:

image

Please let me know how I can test the on-press event. Any help is appreciated.

@LaurenceM10
Copy link

Same issue here!

@faizazafar
Copy link

Any solution ? @Prernabudh

@itsFarzi
Copy link

itsFarzi commented Nov 23, 2022

@faizazafar @Prernabudh you guys can try

const item = await findByTestId("switch");
fireEvent(item, 'onChange', {nativeEvent: {}}));

for react native

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants