@@ -12,37 +12,7 @@ vi.mock("@calcom/prisma", () => ({
12
12
} ) ) ;
13
13
14
14
const handlePrismockBugs = ( ) => {
15
- const __updateBooking = prismock . booking . update ;
16
- const __findFirstOrThrowBooking = prismock . booking . findFirstOrThrow ;
17
15
const __findManyWebhook = prismock . webhook . findMany ;
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
- prismock . booking . update = ( ...rest : any [ ] ) => {
20
- // There is a bug in prismock where it considers `createMany` and `create` itself to have the data directly
21
- // In booking flows, we encounter such scenario, so let's fix that here directly till it's fixed in prismock
22
- if ( rest [ 0 ] . data . references ?. createMany ) {
23
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
- // @ts -ignore
25
- rest [ 0 ] . data . references . createMany = rest [ 0 ] . data . references ?. createMany . data ;
26
- logger . silly ( "Fixed Prismock bug" ) ;
27
- }
28
- if ( rest [ 0 ] . data . references ?. create ) {
29
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
30
- // @ts -ignore
31
- rest [ 0 ] . data . references . create = rest [ 0 ] . data . references ?. create . data ;
32
- logger . silly ( "Fixed Prismock bug-1" ) ;
33
- }
34
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
35
- // @ts -ignore
36
- return __updateBooking ( ...rest ) ;
37
- } ;
38
-
39
- prismock . booking . findFirstOrThrow = ( ...rest : any [ ] ) => {
40
- const { where } = rest [ 0 ] ;
41
- delete where . NOT ;
42
- logger . silly ( "Fixed Prismock bug with using NOT in where clause" ) ;
43
-
44
- return __findFirstOrThrowBooking ( ...rest ) ;
45
- } ;
46
16
47
17
// eslint-disable-next-line @typescript-eslint/no-explicit-any
48
18
prismock . webhook . findMany = ( ...rest : any [ ] ) => {
0 commit comments