jest-mock-extended icon indicating copy to clipboard operation
jest-mock-extended copied to clipboard

Doesn't mock special fn in prisma package

Open hadeelfouad opened this issue 2 years ago • 0 comments

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.

hadeelfouad avatar Jan 26 '23 16:01 hadeelfouad