Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions apps/api/v1/test/lib/utils/isLockedOrBlocked.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import prismock from "../../../../../../tests/libs/__mocks__/prisma";

import type { NextApiRequest } from "next";
import { describe, expect, it, beforeEach } from "vitest";

import { WatchlistSeverity } from "@calcom/prisma/enums";

import { isLockedOrBlocked } from "../../../lib/utils/isLockedOrBlocked";

describe("isLockedOrBlocked", () => {
Expand All @@ -18,21 +17,20 @@ describe("isLockedOrBlocked", () => {
{
type: "DOMAIN",
value: "blocked.com",
severity: WatchlistSeverity.CRITICAL,
createdById: 1,
},
],
});
});

it("should return false if no user in request", async () => {
const req = { userId: null, user: null } as any;
const req = { userId: null, user: null } as unknown as NextApiRequest;
const result = await isLockedOrBlocked(req);
expect(result).toBe(false);
});

it("should return false if user has no email", async () => {
const req = { userId: 123, user: { email: null } } as any;
const req = { userId: 123, user: { email: null } } as unknown as NextApiRequest;
const result = await isLockedOrBlocked(req);
expect(result).toBe(false);
});
Expand All @@ -44,7 +42,7 @@ describe("isLockedOrBlocked", () => {
locked: true,
email: "test@example.com",
},
} as any;
} as unknown as NextApiRequest;

const result = await isLockedOrBlocked(req);
expect(result).toBe(true);
Expand All @@ -57,7 +55,7 @@ describe("isLockedOrBlocked", () => {
locked: false,
email: "test@blocked.com",
},
} as any;
} as unknown as NextApiRequest;

const result = await isLockedOrBlocked(req);
expect(result).toBe(true);
Expand All @@ -70,7 +68,7 @@ describe("isLockedOrBlocked", () => {
locked: false,
email: "test@example.com",
},
} as any;
} as unknown as NextApiRequest;

const result = await isLockedOrBlocked(req);
expect(result).toBe(false);
Expand All @@ -83,7 +81,7 @@ describe("isLockedOrBlocked", () => {
locked: false,
email: "test@BLOCKED.COM",
},
} as any;
} as unknown as NextApiRequest;

const result = await isLockedOrBlocked(req);
expect(result).toBe(true);
Expand Down
Loading
Loading