fix: disable plain for self hosters (#19853)
* fix: disable plain for self hosters * fix type error * test update --------- Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
1 parent
07716474d3
commit
082f8e1b04
4 files changed
+224
-199
No files matched your search
@@ -5,6 +5,7 @@ import type { NextRequest } from "next/server";
|
||||
import { describe, it, expect, vi, beforeAll, beforeEach } from "vitest";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { IS_PLAIN_CHAT_ENABLED } from "@calcom/lib/constants";
|
||||
|
||||
import { POST } from "../../app/api/plain-hash/route";
|
||||
|
||||
@@ -47,12 +48,24 @@ describe("Plain Integration API", () => {
|
||||
beforeAll(() => {
|
||||
process.env.PLAIN_CHAT_HMAC_SECRET_KEY = "test-secret";
|
||||
process.env.NEXT_PUBLIC_PLAIN_CHAT_ID = "test-chat-id";
|
||||
// Force the feature to be enabled for tests
|
||||
vi.mock("@calcom/lib/constants", () => ({
|
||||
IS_PLAIN_CHAT_ENABLED: true,
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks();
|
||||
});
|
||||
|
||||
// Skip all tests if the feature is disabled
|
||||
if (!IS_PLAIN_CHAT_ENABLED) {
|
||||
it("skips tests when Plain Chat is disabled", () => {
|
||||
console.log("Plain Chat is disabled, skipping tests");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const tiers = [
|
||||
{ tier: "free", teams: [] },
|
||||
{ tier: "teams", teams: [{ team: { id: 2 } }] },
|
||||
|
||||
Reference in new issue
Block a user