Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm writing a test for a function that uses
UseStorage()
and save an item throughSetItem()
. I would like to useGetItem()
in the test to verify that data are saved as expected. How should I approach this?I'm using Nuxt 3 with
@nuxt/test-utils
and I been failing at:ReferenceError: useStorage is not defined
I have resolved this by following this answer. However now I'm stuck at that the actual function can't accessuseStorage()
:ReferenceError: useStorage is not defined
That's because in the answer he even changed the actual implementation to use the mock which I don't perceive as a correct solution.
This case is also mentioned in the docs. Using this approach I get stuck at
Error: Cannot find import "useStorage" to mock
.What is the correct approach to test such function?
Beta Was this translation helpful? Give feedback.
All reactions