Skip to content

Commit d543d54

Browse files
feat: add prisma-mock for enhanced testing with Prisma client
1 parent 943e235 commit d543d54

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

backend/src/tests/prisma-mock.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { PrismaClient } from '@prisma/client';
2+
import { mockDeep, mockReset, DeepMockProxy } from 'jest-mock-extended';
3+
4+
// Create a mock instance of the Prisma client
5+
export const prisma = mockDeep<PrismaClient>();
6+
7+
// Factory for creating a fresh mock for each test
8+
export const createMockPrismaClient = (): DeepMockProxy<PrismaClient> => {
9+
mockReset(prisma);
10+
return prisma;
11+
};

0 commit comments

Comments
 (0)