unit testing with @default() value, using jest-mock-extended
Hello :) I'm not sure this is the appropriate place to post this, but I hope I can get some help here. I'm currently working on a project and was looking into unit testing my prisma extended client with unit tests and jest.
8 Replies
Unit testing with Prisma ORM | Prisma Documentation
Learn how to setup and run unit tests with Prisma Client
The issue is the
mockResolvedValue
function expects my user object to have an ID, as specified in the model. I don't believe I should have to include an ID here, as it will be generated by Prisma. is there any way around this?
upon supplying an id, it still errors but the expected object isn't the one i need - i want it to generate the id and return that object, am i thinking about this wrong?update: i'm now getting this error, not a clue why or how to fix
on line 10