2023-05-24 23:35:44 +00:00
|
|
|
import { beforeEach, vi } from "vitest";
|
|
|
|
import { mockDeep, mockReset } from "vitest-mock-extended";
|
|
|
|
|
2023-08-24 09:14:10 +00:00
|
|
|
import type { PrismaClient } from "@calcom/prisma";
|
2023-09-04 13:05:34 +00:00
|
|
|
import * as selects from "@calcom/prisma/selects";
|
2023-08-24 09:14:10 +00:00
|
|
|
|
2023-05-24 23:35:44 +00:00
|
|
|
vi.mock("@calcom/prisma", () => ({
|
|
|
|
default: prisma,
|
2023-08-29 15:29:41 +00:00
|
|
|
prisma,
|
2023-09-04 13:05:34 +00:00
|
|
|
...selects,
|
2023-05-24 23:35:44 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
mockReset(prisma);
|
|
|
|
});
|
|
|
|
|
2023-09-04 13:05:34 +00:00
|
|
|
// const prisma = mockDeep<PrismaClient>(
|
|
|
|
// Ensure that all unit tests properly mock the prisma calls that are needed and then enforce this, so that accidental DB queries don't occur
|
|
|
|
// {
|
|
|
|
// fallbackMockImplementation: () => {
|
|
|
|
// throw new Error("Unimplemented");
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// );
|
2023-05-24 23:35:44 +00:00
|
|
|
const prisma = mockDeep<PrismaClient>();
|
|
|
|
export default prisma;
|