Skip to content

Does initial state work with setup stores for testing/pinia? #2028

Closed Answered by posva
kalvenschraut asked this question in Help and Questions
Discussion options

You must be logged in to vote

initial state should work for both setup and option stores. Are you sure you are calling useStore() after mounting? like shown at https://pinia.vuejs.org/cookbook/testing.html#initial-state ? Otherwise you will need to pass the testing pinia to the useStore() function. You can see an example at https://pinia.vuejs.org/cookbook/testing.html#mocking-getters although the real explanation is at https://pinia.vuejs.org/ssr/

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@kalvenschraut
Comment options

@posva
Comment options

posva Mar 6, 2023
Maintainer

@kalvenschraut
Comment options

@kalvenschraut
Comment options

@posva
Comment options

posva Mar 6, 2023
Maintainer

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants