fix: upgrade prismock to 1.33.4 (#17735)

* upgrade prismock, removed 2 hacks, update 3 tests

* yarnlock changes
This commit is contained in:
Vijay authored and GitHub committed 2024-11-19 23:20:27 +00:00
1 parent dfdb04acf4
commit e3abd35ba7
4 files changed
+95 -238

No files matched your search

-30
View File
@@ -12,37 +12,7 @@ vi.mock("@calcom/prisma", () => ({
}));
const handlePrismockBugs = () => {
const __updateBooking = prismock.booking.update;
const __findFirstOrThrowBooking = prismock.booking.findFirstOrThrow;
const __findManyWebhook = prismock.webhook.findMany;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
prismock.booking.update = (...rest: any[]) => {
// There is a bug in prismock where it considers `createMany` and `create` itself to have the data directly
// In booking flows, we encounter such scenario, so let's fix that here directly till it's fixed in prismock
if (rest[0].data.references?.createMany) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
rest[0].data.references.createMany = rest[0].data.references?.createMany.data;
logger.silly("Fixed Prismock bug");
}
if (rest[0].data.references?.create) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
rest[0].data.references.create = rest[0].data.references?.create.data;
logger.silly("Fixed Prismock bug-1");
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return __updateBooking(...rest);
};
prismock.booking.findFirstOrThrow = (...rest: any[]) => {
const { where } = rest[0];
delete where.NOT;
logger.silly("Fixed Prismock bug with using NOT in where clause");
return __findFirstOrThrowBooking(...rest);
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
prismock.webhook.findMany = (...rest: any[]) => {