Issue with FetchHttpClient and MSW in Test Environment with Happy-DOM
Hey. Does anybody know how effect treats
I have the following layers, services defined:
I use the
I also have Mocked Service Worker (MSW) handlers setup but by the look of it, the
For some more context I use:
- vitest
- happy-dom for this test file
- @testing-library/react to test the hook
My test-setup looks like this:
I would assume that since I have
this will only listen to (intercept) request fired from the node implementation of the fetch but
FetchHttpClient in test environment?I have the following layers, services defined:
I use the
RuntimeClient in a couple of actions and I am trying to write unit test for a react hook that is using those actions.I also have Mocked Service Worker (MSW) handlers setup but by the look of it, the
FetchHttpClient doesn't fire any request. I only assume this as I am not very familiar how it works in test environment. Any idea how I could narrow the issue down?For some more context I use:
- vitest
- happy-dom for this test file
- @testing-library/react to test the hook
My test-setup looks like this:
I would assume that since I have
import { setupServer } from 'msw/node',this will only listen to (intercept) request fired from the node implementation of the fetch but
happy-dom and my application will use the fetch implemented in window.