How to use createTestingPinia()
when pinia it is used outside a component
#975
Unanswered
yakobe
asked this question in
Help and Questions
Replies: 1 comment 3 replies
-
You need to call |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Imagine i have some code (eg a composable) that uses a store. I would like to test the code with jest and mock the store with
createTestingPinia()
. However, the actions of the store are not mocked and still call api's etc.I imagine this is because my code does not know that it should be using the pinia created by
createTestingPinia()
and maybe creates it's own instance of pinia? Is it possible to somehow so that i can spy on an action to ensure it is called?Many thanks☺️
Beta Was this translation helpful? Give feedback.
All reactions