React Testing: Act and Assert¶
2. Act¶
act¶
Extends the testing util from React
When to use act?¶
Firing events¶
userEvent vs fireEvent¶
userEvent
- simulates a user
- clicking a button will focus the button
- everything is async/await
fireEvent
- triggers the DOM event
- clicking a button won't focus
3. Assert in Test¶
Last update:
2023-04-24