Vue · Middle · Question 72 of 75

In a component test, why await flushPromises() after clicking a button that triggers an API call?

Explanation

await trigger() waits only for Vue's DOM update; network promises need an extra flush.

Further reading

Problem with a question

Vue · Middle · question 72

Test yourself

Take the Vue · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz