loading...

re: Formik & React Testing Library and Screaming at a Computer for an Hour VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Yeah, this will give you a false positive.
 
 

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.

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

Basically like this:

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

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

 

If you do not await the wait in an async function, the test is over before the expectation could be evaluated.

Code of Conduct Report abuse