Jest test for tRPC route
Hi guys,
I have been using Jest to test tRPC routes in a project like this:
With
"@trpc/server": "^10.9.0"
- everything works as expected.
However in a new project using the t-3 App router from npm create t3-app@latest
which has "@trpc/server": "^10.43.6",
:
'createCaller' is deprecated.ts(6385)
The types file for router.d.ts
say to use t.createCallerFactory(router)
instead and links to the docs: https://trpc.io/docs/server/server-side-calls
But I am struggling to make this work within the t-3 set up.
Has anyone else had this problem? Or any suggestions on how to fix it/ work around it?
ThanksServer Side Calls | tRPC
You may need to call your procedure(s) directly from the same server they're hosted in, createCallerFactory() can be used to achieve this. This is useful for server-side calls and for integration testing of your tRPC procedures.
0 Replies