Skip to content

How to mock in the tests the nuxt context #1710

Discussion options

You must be logged in to vote

For anyone trying to mock $nuxt in their unit tests of the store the solution is with the pinia plugins. Simply add to your pinia a plugin with the mock of axios inside like follows:

const pinia = createPinia()
pinia.use(() => ({
  $nuxt: {
    app: { SOME_OF_YOUR_DATA_TO_MOCK }
  }
}))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kriskw1999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant