Properly mocking a composable function with vitest
In my Vue 3 app, I use the pattern of having a composable that contains methods that will handle fetching some data from various APIs. The reason they’re composables rather than simple functions is that there’s some route metadata that I need to grab from useRoute
/useRouter
, plus data from some other composables in the app.