Looking for way to test nexus resolvers/graphQL API with mocked Prisma client #1105
Unanswered
bitofbreeze
asked this question in
Q&A
Replies: 1 comment 3 replies
-
What kinds of problems are you running into? It seems like a reasonable thing to do with Jest or some some other testing library that supports mocks. That said, what do you mean by "testing the the state is updated appropriately"? To me this sounds like you want to assert that the underlying database was updated. In that case, shouldn't you just use the prisma client without mocking it? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The official docs only mention how to test nexus and prisma with a live server https://nexusjs.org/docs/getting-started/tutorial/chapter-testing-with-prisma/ but I'd like to test with a mocked Prisma client.
A possible workflow I have in mind is mocking the state of the prisma client db and then performing a query or mutation and testing the the state is updated appropriately. I'd also like to be able to execute the query as a user.
Is this not a common use case? Having trouble finding anything.
Beta Was this translation helpful? Give feedback.
All reactions