Kay Khan
07/20/2022, 3:24 PMimport { PrismaClient } from "@prisma/client";
import { mockDeep, mockReset, DeepMockProxy } from "jest-mock-extended";
import { PrismaService } from "@services/prisma.service";
jest.mock("@services/prisma.service", () => ({
__esModule: true,
PrismaService: mockDeep<PrismaClient>(),
}));
beforeEach(() => {
mockReset(PrismaMock);
});
export const PrismaMock = PrismaService as unknown as DeepMockProxy<PrismaClient>;
and then in my test i am using it... However its still connecting to the live (local) db.
PrismaMock.nft_collection.create.mockResolvedValueOnce({});
const [response, error] = await CreateCollection(payload);
Not sure whats going on, why Prisma is not being mocked?Kay Khan
07/20/2022, 3:42 PMPrismaMock is above the import of CreateCollection