Mocking a Pinia store - help needed #927
Unanswered
CRBroughton
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there all.
I've been playing around with Vitest and Pinia, however I've ran into a bit of a brick wall with testing a Pinia store. I've got the below test that simply has a boolean, and a function that set the boolean to true, however the test fails. Looking through the console.log's, I can see the value changing in the store, but the test doesn't reflect that. I'm guessing it's either the implementation of the mock itself (something admittedly I don't know much about), or how the store is being used in the tests.
One thing I tried was deleting the bottom test and that passes, which suggests it's not the tests, or something is 'leaking' through the previous test into the following tests.
Any help is greatly appreciated :)
Repository with the issue: https://github.com/CRBroughton/pinia-test-issue
Test:
Store file:
Beta Was this translation helpful? Give feedback.
All reactions