Skip to content

Commit 7cd8dbf

Browse files
chore: Watchlist schema update (calcom#24246)
* watchlist schema update * changes addressed * no backfill audit * fix type * fix flow of migration * fix err * type err fix * add if exists check in migration
1 parent 654a865 commit 7cd8dbf

6 files changed

Lines changed: 200 additions & 77 deletions

File tree

apps/api/v1/test/lib/utils/isLockedOrBlocked.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import prismock from "../../../../../../tests/libs/__mocks__/prisma";
22

3+
import type { NextApiRequest } from "next";
34
import { describe, expect, it, beforeEach } from "vitest";
45

5-
import { WatchlistSeverity } from "@calcom/prisma/enums";
6-
76
import { isLockedOrBlocked } from "../../../lib/utils/isLockedOrBlocked";
87

98
describe("isLockedOrBlocked", () => {
@@ -18,21 +17,20 @@ describe("isLockedOrBlocked", () => {
1817
{
1918
type: "DOMAIN",
2019
value: "blocked.com",
21-
severity: WatchlistSeverity.CRITICAL,
2220
createdById: 1,
2321
},
2422
],
2523
});
2624
});
2725

2826
it("should return false if no user in request", async () => {
29-
const req = { userId: null, user: null } as any;
27+
const req = { userId: null, user: null } as unknown as NextApiRequest;
3028
const result = await isLockedOrBlocked(req);
3129
expect(result).toBe(false);
3230
});
3331

3432
it("should return false if user has no email", async () => {
35-
const req = { userId: 123, user: { email: null } } as any;
33+
const req = { userId: 123, user: { email: null } } as unknown as NextApiRequest;
3634
const result = await isLockedOrBlocked(req);
3735
expect(result).toBe(false);
3836
});
@@ -44,7 +42,7 @@ describe("isLockedOrBlocked", () => {
4442
locked: true,
4543
email: "test@example.com",
4644
},
47-
} as any;
45+
} as unknown as NextApiRequest;
4846

4947
const result = await isLockedOrBlocked(req);
5048
expect(result).toBe(true);
@@ -57,7 +55,7 @@ describe("isLockedOrBlocked", () => {
5755
locked: false,
5856
email: "test@blocked.com",
5957
},
60-
} as any;
58+
} as unknown as NextApiRequest;
6159

6260
const result = await isLockedOrBlocked(req);
6361
expect(result).toBe(true);
@@ -70,7 +68,7 @@ describe("isLockedOrBlocked", () => {
7068
locked: false,
7169
email: "test@example.com",
7270
},
73-
} as any;
71+
} as unknown as NextApiRequest;
7472

7573
const result = await isLockedOrBlocked(req);
7674
expect(result).toBe(false);
@@ -83,7 +81,7 @@ describe("isLockedOrBlocked", () => {
8381
locked: false,
8482
email: "test@BLOCKED.COM",
8583
},
86-
} as any;
84+
} as unknown as NextApiRequest;
8785

8886
const result = await isLockedOrBlocked(req);
8987
expect(result).toBe(true);

0 commit comments

Comments
 (0)