DEV Community

Discussion on: Formik & React Testing Library and Screaming at a Computer for an Hour

Collapse
 
rangeoshun profile image
Abel Varga

In my case, I needed not just await the expect, but the problem also was the Formik did not call the handleSubmit callback. I had to fire a submit event on the form element itself.

Thread Thread
 
xap5xap profile image
XAVIER PEREZ

Hello. How do you submit an event on the form in the test?

Thread Thread
 
rangeoshun profile image
Abel Varga • Edited

Basically like this:

fireEvent.submit(container.querySelector('form'))

container is the value returned in the object by the render method.