test store not updated in nested axios call #2202
Unanswered
havok2063
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.
-
I have a Vue component for a login form. On form submit it performs an axios call to log in. In the response it adds the
auth
data to a pinia store, then makes a second axios call to get additionaluser
info to add to the store. The code itself runs fine in my application, and the login form works as expected.I'm trying to write a test using vitest for the login. I've mocked the response data for both axios calls. The test successfully runs the first axios call, and updates the
store.auth
with the mocked test data. However, it fails to set thestore.user
with the mock test user data. Adding some logging, I can see the 2nd axios call is getting called, and it's returning the mock test user data, but I don't know why it's not updating the pinia store. Anyone know why this might be happening?Login Vuetify Component
Test
Test Error
Beta Was this translation helpful? Give feedback.
All reactions