T
TanStack2y ago
fascinating-indigo

How do I mock API responses from useQuery with Vue and Vitest?

Does anyone have an example?
1 Reply
fascinating-indigo
fascinating-indigoOP2y ago
Based on my reading is seems like using Mock Service Worker is the recommended way to mock the API requests but I’m having a hard time finding examples with Vue Query. I think I got it working with MSW. I’m using Vue Test Utils with Vitest and I had to add await flushPromises() to the test.

Did you find this page helpful?