* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
114 lines
2.7 KiB
TypeScript
114 lines
2.7 KiB
TypeScript
import matchers from "@testing-library/jest-dom/matchers";
|
|
import { cleanup } from "@testing-library/react";
|
|
import React from "react";
|
|
import { afterEach, expect, vi } from "vitest";
|
|
|
|
// For next.js webapp compponent that use "preserve" for jsx in tsconfig.json
|
|
global.React = React;
|
|
|
|
vi.mock("framer-motion", () => ({
|
|
AnimatePresence: ({ children }: { children: React.ReactNode }) => <>{children}</>,
|
|
LazyMotion: ({ children }: { children: React.ReactNode }) => <>{children}</>,
|
|
m: {
|
|
span: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
|
|
div: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
|
},
|
|
useReducedMotion: () => false,
|
|
useAnimate: () => [null, vi.fn()],
|
|
}));
|
|
|
|
// Add new mocks
|
|
vi.mock("next-seo", () => ({
|
|
NextSeo: () => null,
|
|
LogoJsonLd: () => null,
|
|
}));
|
|
|
|
vi.mock("react-sticky-box", () => ({
|
|
default: ({ children }: { children: React.ReactNode }) => <div data-testid="sticky-box">{children}</div>,
|
|
}));
|
|
|
|
vi.mock("next/navigation", async () => ({
|
|
...((await vi.importActual("next/navigation")) as object),
|
|
useRouter() {
|
|
return {
|
|
route: "/",
|
|
pathname: "",
|
|
query: {},
|
|
asPath: "",
|
|
push: vi.fn(),
|
|
};
|
|
},
|
|
useSearchParams() {
|
|
return new URLSearchParams();
|
|
},
|
|
}));
|
|
|
|
vi.mock("@calcom/lib/OgImages", async () => {
|
|
return {};
|
|
});
|
|
|
|
vi.mock("@calcom/lib/hooks/useLocale", () => ({
|
|
useLocale: () => {
|
|
return {
|
|
t: (str: string) => str,
|
|
isLocaleReady: true,
|
|
i18n: {
|
|
language: "en",
|
|
defaultLocale: "en",
|
|
locales: ["en"],
|
|
exists: () => false,
|
|
},
|
|
};
|
|
},
|
|
}));
|
|
|
|
vi.mock("@calcom/atoms/hooks/useIsPlatform", () => ({
|
|
useIsPlatform: () => {
|
|
return false;
|
|
},
|
|
}));
|
|
|
|
vi.mock("@calcom/features/eventtypes/lib/getEventTypesByViewer", () => ({}));
|
|
vi.mock("@calcom/features/eventtypes/lib/getEventTypesPublic", () => ({}));
|
|
vi.mock("@calcom/ui/classNames", () => ({
|
|
default: (...args: string[]) => {
|
|
return args.filter(Boolean).join(" ");
|
|
},
|
|
}));
|
|
|
|
expect.extend({
|
|
tabToBeDisabled(received) {
|
|
const isDisabled = received.classList.contains("pointer-events-none");
|
|
return {
|
|
pass: isDisabled,
|
|
message: () => `Expected tab to be disabled`,
|
|
};
|
|
},
|
|
});
|
|
|
|
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
disconnect: vi.fn(),
|
|
}));
|
|
|
|
Object.defineProperty(window, "matchMedia", {
|
|
writable: true,
|
|
value: vi.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(),
|
|
removeListener: vi.fn(),
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
});
|
|
|
|
expect.extend(matchers);
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
});
|