Vue · Senior · Question 66 of 75

How do you mock API calls in component tests without mocking fetch per test?

Explanation

The same handlers can be reused in tests, Storybook and local development, and tests stay independent of the HTTP library.

Further reading

Problem with a question

Vue · Senior · question 66

Test yourself

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

Take this quiz