Unable to mock store action in composable unit test with vitest #2404
Unanswered
benazir-sba
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Setting stubActions to false is not working for me. I am mocking my store (inside a composable unit test) in the following way:
Then in my test I am creating test pinia with
stubActionsset tofalseand assigning that pinia instance to my store. Inside myputResponsefunction a store actionupdateResponseis called. But in the test the expectationexpect(responseStore.updateResponse).toHaveBeenCalledTimes(1)fails with the error:AssertionError: expected "spy" to be called 1 times, but got 0 timesI am stuck here for quite some time now. Please tell me what am i doing wrong here ? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions