How to mock in the tests the nuxt context #1710
Answered
by
kriskw1999
kriskw1999
asked this question in
Help and Questions
-
Hello I am actually using nuxt and I have no idea to how to mock the this.$nuxt.something when testing. At runtime it is all correctly setup but when I need to test I have no possibility to mock the $nuxt. Is there any way to inject in such way this context? |
Beta Was this translation helpful? Give feedback.
Answered by
kriskw1999
Oct 6, 2022
Replies: 1 comment
-
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:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kriskw1999
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: