Test React component using trpc client and `useSuspenseQuery`
Hello !
I'm trying to test my React component that's querying through a tRPC client and
useSuspenseQuery
.
I'm using Jest and I'm mocking the tPRC server with Mockttp.
I suppose that when using useSuspenseQuery
we should mock that query using a stream, so my test looks like this:
I'm running my tests using mockttp -c jest
as recommended in Mockttp's documentation. That part looks fine.
My problem is that when running this test I'm having the following error:
I'm not super familiar with streams but I'm wondering if I'm using the right function from mockttp to mock the useSuspenseQuery
or if I'm not passing the right thing to thenStream(...)
.
Any help is appreciated, thanks !0 Replies