cal.pub0.org/tests/libs/__mocks__/prisma.ts

27 lines
689 B
TypeScript
Raw Normal View History

import { beforeEach, vi } from "vitest";
import { mockDeep, mockReset } from "vitest-mock-extended";
import type { PrismaClient } from "@calcom/prisma";
2023-09-04 13:05:34 +00:00
import * as selects from "@calcom/prisma/selects";
vi.mock("@calcom/prisma", () => ({
default: prisma,
2023-08-29 15:29:41 +00:00
prisma,
2023-09-04 13:05:34 +00:00
...selects,
}));
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");
// },
// }
// );
const prisma = mockDeep<PrismaClient>();
export default prisma;