T
TanStack3y ago
ambitious-aqua

Solid Query: "mutate" is not a function when testing

Hello everyone. I have a page component Post.page.tsx that uses createQuery and createMutation. When I try to test that component, the error says TypeError: mutate is not a function. I have a test utils that's basically a wrapper of render from @solidjs/testing-library. The only place where I call mutate function in that page component is in onDeletePost function in Post.vm.tsx file which is used inside of Post.page.tsx, but only called when some button clicked. I'm not sure why the error says like so, even if I'm not even clicked anything in my test case. here is the repo: https://github.com/rifandani/solid-app
GitHub
GitHub - rifandani/solid-app: Solid template with typescript, vite,...
Solid template with typescript, vite, vitest, testing-library, router, msw, tailwindcss, tanstack solid query, zod - GitHub - rifandani/solid-app: Solid template with typescript, vite, vitest, test...
No description
No description
No description
1 Reply
harsh-harlequin
harsh-harlequin3y ago
Did you ever figure it out @chess_1800 ? Im having a similarly weird issue in Solid with the queryClient claiming it isnt set

Did you find this page helpful?