Can functions that are in a standalone node server be mocked without having to start a server in vitest? #7102
Unanswered
dsleandata
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, i have a node server running in my local environment hosted on localhost:5000. I also have a vitest test running, where I want to test an
/endpoint
in the node server. There is a function in/endpoint
that i want to mock, but it seems like the mock is not working and its calling the actual function. The function itselffunctionIWantToMock
is async and returns a map after calling on a promise chain within it (which I want to avoid and want it to just return the map) Is this because vitest can't mock a function in a server not tied to it? any documentation i can read to understand this better? Or should I be mocking instead of spying?For reference, this is my vitest test file:
Beta Was this translation helpful? Give feedback.
All reactions