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
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
I have next hook implementation:
where useApi is overlap of useAsync hook and it returns function to execution and used like:
and postRecommendations is simple axios api call
I was trying to write unit test for onError case:
I get next error typed near the unit tests without any assertation fail:
Cannot read properties of undefined (reading 'indexOf')
I was trying also other approaches like:
But I had same error
Moreover, I tried to return Promise.reject without luck with same error
I am using vitest v:2.0.0
If anyone has encountered a similar implementation and has successfully written unit tests for it, please share your solution with me.
Beta Was this translation helpful? Give feedback.
All reactions