You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a composable store that has a watch - a TestingPinia instance of that store will run the actions as if they were not stubbed. Actions outside of the watch are stubbed as expected.
# Arealstore..exportconstuseSomeStore=defineStore('somestore',()=>{constsomeId=ref(10)watch(someId,()=>{someAction()},{immediate: true})asyncfunctionsomeAction(){try{// Something here, like an API call.}catch(e){console.error(e)}}})
# Aspec..it('should pass',async()=>{constpinia=createTestingPinia({ initialState,stubActions: true})constwrapper=mount(someComponent,{global: {plugins: [pinia, ...]}})// If the initial state has someId defined, or if you set someId .. the action is run unstubbed.})
Expected behavior
The action to have been stubbed and not run...
Actual behavior
The original, unstubbed action is run.
Additional information
It took me a while to figure out why I was getting a bunch of API calls making their way through until I realized the actual actions were being run from the watch.
The text was updated successfully, but these errors were encountered:
Reproduction & Steps to reproduce the bug
Given a composable store that has a watch - a
TestingPinia
instance of that store will run the actions as if they were not stubbed. Actions outside of the watch are stubbed as expected.Expected behavior
The action to have been stubbed and not run...
Actual behavior
The original, unstubbed action is run.
Additional information
It took me a while to figure out why I was getting a bunch of API calls making their way through until I realized the actual actions were being run from the watch.
The text was updated successfully, but these errors were encountered: