'callback not executing in JEST testing?
callback inside useEffect not executing in JEST testing?Do I have to wait or something else. Repeat-callback inside useEffect not executing in JEST testing?Do I have to wait or something else. Repeat-callback inside useEffect not executing in JEST testing?Do I have to wait or something else.
Solution 1:[1]
Judging by the names of your function calls, yes, you would have to wait. fetch implies that you are performing an ansynchronous (a promise) call for data. That would, most likely, set some form of state. Doing that would rerender something (which takes a moment). Waiting for data changes is one of the hardest bits to wrap your head around when writing testing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Steve -Cutter- Blades |
