miracoly
Mocking Pinia Store in Vitest Component Test
Thanks for the idea!
I was able to mock it with
mockNuxtImport()
and vitest
's mock functionality.
That does the trick.
In my component, I utilize callOnce, and it appears to truly execute only once within a single test file. That's why retrieveAllLeagues
isn't restored with mockRestore()
. I suppose if someone wants to ensure the correct methods are called with callOnce
, they either need to assert them in the proper sequence or employ multiple test files.2 replies