[Vuejs]-How to mock the route object in Vue 3 composition?

0👍

✅

Since the route object is no longer a global object you have to do the following:

const route = { fullPath: '/', path: '/' };

vi.mock('vue-router', () => ({
  useRoute: () => route,
}));

Leave a comment