Replies: 1 comment
-
There is a guide on how to mock classes: https://vitest.dev/guide/mocking.html#classes |
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
-
Assume I have 2 modules that defines
Repo
andService
classes.I these classes the important thing is we are not passing Repo instance to the constructor of Service rather they are initialized inline.
Following is the test I've written and I would like to update the mockReturnValue within the test so that I can have different values suitable for each test. Following doesn't work and find() returns undefined but something like this even possible in Vitest? (As far as I remember, something like this is possible in Jest)
Beta Was this translation helpful? Give feedback.
All reactions