Hello Timothy, and if count was not in the dom but was a state that we were passing to other component or we were using for another functionality, how would we test that value changed?
Thanks for the question. I made a video giving a general idea of how to go about testing state in this particular scenario. Here's the link th-cam.com/video/3ZR_u113e5M/w-d-xo.html If there is any more questions or things that you aren't clear about, do let me know. And thanks very much for watching the video
You will need to use the jest mock function i.e. jest.fn() and pass it as a prop to the component. Take a look at this gist gist.github.com/timdereaper1/901435748f9fdca68afca053fa3b1cef
I did not expect a video with less than 1k views to clear all my doubts that were not resolved after watching so many tutorials.
Hello Timothy,
and if count was not in the dom but was a state that we were passing to other component or we were using for another functionality, how would we test that value changed?
Thanks for the question. I made a video giving a general idea of how to go about testing state in this particular scenario. Here's the link th-cam.com/video/3ZR_u113e5M/w-d-xo.html
If there is any more questions or things that you aren't clear about, do let me know. And thanks very much for watching the video
@@timothyamo Thank you very much Timothy!! Keep it up!!
Great Work, Make more tutorials
Thank you, I will.
what if i have a component that is getting a setState func as a prop. how can i mocking a setState func?
You will need to use the jest mock function i.e. jest.fn() and pass it as a prop to the component. Take a look at this gist gist.github.com/timdereaper1/901435748f9fdca68afca053fa3b1cef