Vue · Middle · Question 72 of 75
In a component test, why await flushPromises() after clicking a button that triggers an API call?
- ✓Correct answer: To let pending promises (the mocked request and its
then) resolve before asserting on the DOM - 2To reset the store
- 3To clear timers
Explanation
await trigger() waits only for Vue's DOM update; network promises need an extra flush.