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
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
I read this guide
Unit testing with Prisma ORM | Prisma Documentation
Learn how to setup and run unit tests with Prisma Client
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
No description
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
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?
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
No description
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
update: i'm now getting this error, not a clue why or how to fix
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
No description
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
No description
⋆˚ʚɞ˚⋆
⋆˚ʚɞ˚⋆OP2mo ago
on line 10
Want results from more Discord servers?
Add your server