Testing · Senior · Question 34 of 75
What does act() guarantee in React tests?
- ✓Correct answer: That all updates, effects and scheduled work triggered inside it are flushed before assertions run
- 2That the component renders without errors
- 3That the test runs in the browser
Explanation
The test environment must have IS_REACT_ACT_ENVIRONMENT = true (RTL sets it); otherwise React doesn't warn about missing act.