Closed mpiorowski closed 2 years ago
Sorry, everthing works perfectly :). If anyone will have a similar issue, I was missing:
import 'whatwg-fetch';
beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // Deprecated
removeListener: jest.fn(), // Deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
});
Hello, I have setup up an application using this: https://github.com/mihar-22/svelte-jester#typescript So i got working jest with sveltekit, everything works fine when i render simple page.
But my problem is when i try to add svelte-query. I mocked http requestes using msw, but it seems like the useQuery is in never ending 'loading' state. No errors, no nothing, always loading.
Do i need to do something to make the query works? Maybe my render using svelte-testing-library is not picking up on subscription changes from the query?
I tried adding tick() function from svelte, but it didnt helped.
Would be really greatfull for some help.