jest-mock-extended
jest-mock-extended copied to clipboard
Doesn't mock special fn in prisma package
Tried the following code to mock my PrismaClient using JavaScript
import { PrismaClient } from '@prisma/client';
import { mockDeep } from 'jest-mock-extended';
export const createDatabase = () => {
return mockDeep(PrismaClient.prototype);
}
And it was able to successfully mock all models functions but not any functions starting with $ (for example $transaction, $on, etc.) it still calls the real function even though the PrismaClient is a MockObject.