Anybody got a vitest with T3-app setup?
I'm trying to setup vitest tests with my trpc routes, but after following the official t3 docs (https://create.t3.gg/en/usage/trpc/#sample-integration-test), and the official prisma guide on how to mock the db (https://www.prisma.io/blog/testing-series-1-8eRB5p0Y8o), I am running into the issue of (it seems like) my models not being created.
TypeError: Cannot read properties of undefined (reading 'create')
Does anybody have any projects that have this setup and working? Been picking my brain on this for a few hours and can't understand why my prisma mock isn't working as expected.1 Reply
This is my mock directly taken from the prisma docs
And this is the (test) test i'm trying to execute.
This is very barebones, as this doesn't use TRPC yet, when adding this
prisma
mock to the innerContext, and calling a trpc route, I get the same create
error. But I want this example to be simple for now.