there are mostly examples of testing static react or puppet components on the Internet, and there seems to be no example of testing components after getting data asynchronously. Do I understand the wrong test idea? Or is it the wrong way?
there are mostly examples of testing static react or puppet components on the Internet, and there seems to be no example of testing components after getting data asynchronously. Do I understand the wrong test idea? Or is it the wrong way?
Asynchronous requests are still implemented in the way of Mock. Jest has built-in mock methods (I'm not sure which one I'm using), or use third-party libraries, such as sinon
you're talking about container components. What do you want to test for container components?
do you want to test getting data asynchronously? I'm sure it's not, isn't it? This part is external dependency and should be mock off.
maybe you want to test the logic of the container component after data acquisition, then after mock, test the behavior of the container component (such as whether the properties passed to the self-component are correct), which is no different from testing the puppet component
Previous: How to change the upload program for medium editor?
Next: There are two possible association conditions for left join, either a.uid=b.uid or a.beUid=b.id.