diff --git a/apps/main/src/components/AnimatedBackground.test.tsx b/apps/main/src/components/AnimatedBackground.test.tsx index bd46a88..8eb4c7b 100644 --- a/apps/main/src/components/AnimatedBackground.test.tsx +++ b/apps/main/src/components/AnimatedBackground.test.tsx @@ -27,5 +27,3 @@ describe("AnimatedBackground", () => { expect(wrapper).toHaveClass("inset-0"); }); }); - - diff --git a/apps/main/src/components/AvailabilityCard.test.tsx b/apps/main/src/components/AvailabilityCard.test.tsx index 77b35ab..dfcd822 100644 --- a/apps/main/src/components/AvailabilityCard.test.tsx +++ b/apps/main/src/components/AvailabilityCard.test.tsx @@ -120,5 +120,3 @@ describe("AvailabilityCard", () => { expect(startInput).toBeDisabled(); }); }); - - diff --git a/apps/main/src/components/AvailabilityVisualization.test.tsx b/apps/main/src/components/AvailabilityVisualization.test.tsx index da77358..c9f0be8 100644 --- a/apps/main/src/components/AvailabilityVisualization.test.tsx +++ b/apps/main/src/components/AvailabilityVisualization.test.tsx @@ -65,5 +65,3 @@ describe("AvailabilityVisualization", () => { expect(headers.length).toBeGreaterThan(0); }); }); - - diff --git a/apps/main/src/components/ChannelBadge.test.tsx b/apps/main/src/components/ChannelBadge.test.tsx index d36e589..6f0c421 100644 --- a/apps/main/src/components/ChannelBadge.test.tsx +++ b/apps/main/src/components/ChannelBadge.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from "@testing-library/react"; +import { render } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import { ChannelBadge } from "./ChannelBadge"; @@ -11,7 +11,19 @@ describe("ChannelBadge", () => { }); it("displays initials from tablo name", () => { - const tablo = { name: "Project Alpha", color: "bg-blue-500" } as any; + const tablo = { + name: "Project Alpha", + color: "bg-blue-500", + id: "test-id", + user_id: "user-id", + access_level: "admin", + is_admin: true, + created_at: "2024-01-01T00:00:00Z", + deleted_at: "2024-01-01T00:00:00Z", + position: 0, + status: "active", + image: null, + }; const { container } = render( ); @@ -47,7 +59,19 @@ describe("ChannelBadge", () => { }); it("applies tablo color class when provided", () => { - const tablo = { name: "Test", color: "bg-purple-500" } as any; + const tablo = { + name: "Test", + color: "bg-purple-500", + id: "test-id", + user_id: "user-id", + access_level: "admin", + is_admin: true, + created_at: "2024-01-01T00:00:00Z", + deleted_at: "2024-01-01T00:00:00Z", + position: 0, + status: "active", + image: null, + }; const { container } = render( ); @@ -55,5 +79,3 @@ describe("ChannelBadge", () => { expect(badge).toBeInTheDocument(); }); }); - - diff --git a/apps/main/src/components/ChannelPreview.test.tsx b/apps/main/src/components/ChannelPreview.test.tsx index be35060..5a456a0 100644 --- a/apps/main/src/components/ChannelPreview.test.tsx +++ b/apps/main/src/components/ChannelPreview.test.tsx @@ -5,7 +5,7 @@ import { ChannelPreview } from "./ChannelPreview"; // Mock ChannelBadge vi.mock("./ChannelBadge", () => ({ - ChannelBadge: ({ tablo, displayTitle, isOnline }: any) => ( + ChannelBadge: ({ displayTitle, isOnline }: { displayTitle?: string; isOnline: boolean }) => (
{displayTitle}-{isOnline ? "online" : "offline"}
@@ -30,7 +30,15 @@ describe("ChannelPreview", () => { id: "tablo-1", name: "Test Tablo", color: "bg-blue-500", - } as any; + user_id: "user-id", + access_level: "admin", + is_admin: true, + created_at: "2024-01-01T00:00:00Z", + deleted_at: "2024-01-01T00:00:00Z", + position: 0, + status: "active", + image: null, + }; const defaultProps = { channel: mockChannel, @@ -95,5 +103,3 @@ describe("ChannelPreview", () => { expect(container.querySelector(".bg-blue-500")).toBeInTheDocument(); }); }); - - diff --git a/apps/main/src/components/ClickOutside.test.tsx b/apps/main/src/components/ClickOutside.test.tsx index e13026b..b1ee815 100644 --- a/apps/main/src/components/ClickOutside.test.tsx +++ b/apps/main/src/components/ClickOutside.test.tsx @@ -1,13 +1,13 @@ -import { fireEvent, render, screen } from "@testing-library/react"; +import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { ClickOutside } from "./ClickOutside"; // Mock the useClickOutside hook vi.mock("@xtablo/shared/hooks/useClickOutside", () => ({ useClickOutside: (callback: () => void) => { - const ref = { current: null }; + const ref = { current: null } as { current: null; callback?: () => void }; // Store callback for testing - (ref as any).callback = callback; + ref.callback = callback; return ref; }, })); @@ -53,5 +53,3 @@ describe("ClickOutside", () => { expect(screen.getByText("Test Content")).toBeInTheDocument(); }); }); - - diff --git a/apps/main/src/components/CreateTabloModal.test.tsx b/apps/main/src/components/CreateTabloModal.test.tsx index bcbdd25..ebb5970 100644 --- a/apps/main/src/components/CreateTabloModal.test.tsx +++ b/apps/main/src/components/CreateTabloModal.test.tsx @@ -4,7 +4,13 @@ import { CreateTabloModal } from "./CreateTabloModal"; // Mock ClickOutside vi.mock("./ClickOutside", () => ({ - ClickOutside: ({ children, onClickOutside }: any) => ( + ClickOutside: ({ + children, + onClickOutside, + }: { + children: React.ReactNode; + onClickOutside: () => void; + }) => (
{children}
@@ -117,5 +123,3 @@ describe("CreateTabloModal", () => { expect(createButton).toBeDisabled(); }); }); - - diff --git a/apps/main/src/components/CustomChannelHeader.test.tsx b/apps/main/src/components/CustomChannelHeader.test.tsx index 2baac41..59146b3 100644 --- a/apps/main/src/components/CustomChannelHeader.test.tsx +++ b/apps/main/src/components/CustomChannelHeader.test.tsx @@ -4,7 +4,7 @@ import { CustomChannelHeader } from "./CustomChannelHeader"; // Mock stream-chat-react vi.mock("stream-chat-react", () => ({ - ChannelHeader: ({ Avatar }: any) => ( + ChannelHeader: ({ Avatar }: { Avatar?: () => React.ReactElement }) => (
{Avatar && }
), useChannelStateContext: () => ({ @@ -21,7 +21,7 @@ vi.mock("stream-chat-react", () => ({ // Mock ChannelBadge vi.mock("./ChannelBadge", () => ({ - ChannelBadge: ({ tablo, displayTitle }: any) => ( + ChannelBadge: ({ displayTitle }: { displayTitle?: string }) => (
{displayTitle}
), })); @@ -32,8 +32,16 @@ describe("CustomChannelHeader", () => { id: "test-channel", name: "Test Tablo", color: "bg-blue-500", + user_id: "user-id", + access_level: "admin", + is_admin: true, + created_at: "2024-01-01T00:00:00Z", + deleted_at: "2024-01-01T00:00:00Z", + position: 0, + status: "active", + image: null, }, - ] as any[]; + ]; it("renders without crashing", () => { render(); @@ -107,5 +115,3 @@ describe("CustomChannelHeader", () => { expect(screen.getByTestId("channel-badge")).toBeInTheDocument(); }); }); - - diff --git a/apps/main/src/components/CustomLoadingOverlay.test.tsx b/apps/main/src/components/CustomLoadingOverlay.test.tsx index 1651283..25b1ac9 100644 --- a/apps/main/src/components/CustomLoadingOverlay.test.tsx +++ b/apps/main/src/components/CustomLoadingOverlay.test.tsx @@ -31,5 +31,3 @@ describe("CustomLoadingOverlay", () => { expect(icon).toHaveClass("animate-spin"); }); }); - - diff --git a/apps/main/src/components/CustomModal.test.tsx b/apps/main/src/components/CustomModal.test.tsx index 6f9b420..ca4caa6 100644 --- a/apps/main/src/components/CustomModal.test.tsx +++ b/apps/main/src/components/CustomModal.test.tsx @@ -4,14 +4,19 @@ import { CustomModal } from "./CustomModal"; // Mock Dialog components from shadcn/ui vi.mock("@xtablo/ui/components/dialog", () => ({ - Dialog: ({ open, children }: any) => (open ?
{children}
: null), - DialogContent: ({ children, className }: any) => ( + Dialog: ({ open, children }: { open: boolean; children: React.ReactNode }) => + open ?
{children}
: null, + DialogContent: ({ children, className }: { children: React.ReactNode; className?: string }) => (
{children}
), - DialogHeader: ({ children }: any) =>
{children}
, - DialogTitle: ({ children }: any) =>
{children}
, + DialogHeader: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), + DialogTitle: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), })); describe("CustomModal", () => { @@ -127,5 +132,3 @@ describe("CustomModal", () => { expect(content).toHaveClass("w-auto"); }); }); - - diff --git a/apps/main/src/components/DeleteTabloModal.test.tsx b/apps/main/src/components/DeleteTabloModal.test.tsx index 8b4773b..d4783a3 100644 --- a/apps/main/src/components/DeleteTabloModal.test.tsx +++ b/apps/main/src/components/DeleteTabloModal.test.tsx @@ -4,7 +4,7 @@ import { DeleteTabloModal } from "./DeleteTabloModal"; // Mock ClickOutside vi.mock("./ClickOutside", () => ({ - ClickOutside: ({ children }: any) =>
{children}
, + ClickOutside: ({ children }: { children: React.ReactNode }) =>
{children}
, })); // Mock translations @@ -19,7 +19,15 @@ describe("DeleteTabloModal", () => { id: "tablo-1", name: "Test Tablo", color: "bg-blue-500", - } as any; + user_id: "user-id", + access_level: "admin", + is_admin: true, + created_at: "2024-01-01T00:00:00Z", + deleted_at: "2024-01-01T00:00:00Z", + position: 0, + status: "active", + image: null, + }; const mockOnClose = vi.fn(); const mockOnConfirm = vi.fn(); diff --git a/apps/main/src/components/EmbedConfigModal.test.tsx b/apps/main/src/components/EmbedConfigModal.test.tsx index f4e1c84..1085efc 100644 --- a/apps/main/src/components/EmbedConfigModal.test.tsx +++ b/apps/main/src/components/EmbedConfigModal.test.tsx @@ -4,16 +4,27 @@ import { EmbedConfigModal } from "./EmbedConfigModal"; // Mock Dialog components vi.mock("@xtablo/ui/components/dialog", () => ({ - Dialog: ({ open, children }: any) => (open ?
{children}
: null), - DialogContent: ({ children }: any) =>
{children}
, - DialogHeader: ({ children }: any) =>
{children}
, - DialogTitle: ({ children }: any) =>

{children}

, - DialogFooter: ({ children }: any) =>
{children}
, + Dialog: ({ open, children }: { open: boolean; children: React.ReactNode }) => + open ?
{children}
: null, + DialogContent: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), + DialogHeader: ({ children }: { children: React.ReactNode }) =>
{children}
, + DialogTitle: ({ children }: { children: React.ReactNode }) =>

{children}

, + DialogFooter: ({ children }: { children: React.ReactNode }) =>
{children}
, })); // Mock other UI components vi.mock("@xtablo/ui/components/button", () => ({ - Button: ({ children, onClick, variant }: any) => ( + Button: ({ + children, + onClick, + variant, + }: { + children: React.ReactNode; + onClick: () => void; + variant: string; + }) => ( @@ -21,15 +32,23 @@ vi.mock("@xtablo/ui/components/button", () => ({ })); vi.mock("@xtablo/ui/components/clipboard", () => ({ - CopyButton: ({ label }: any) => , + CopyButton: ({ label }: { label: string }) => , })); vi.mock("@xtablo/ui/components/label", () => ({ - Label: ({ children }: any) => , + Label: ({ children }: { children: React.ReactNode }) => , })); vi.mock("@xtablo/ui/components/select", () => ({ - Select: ({ children, onValueChange, value }: any) => ( + Select: ({ + children, + onValueChange, + value, + }: { + children: React.ReactNode; + onValueChange: (value: string) => void; + value: string; + }) => (
({ {children}
), - SelectTrigger: ({ children }: any) =>
{children}
, + SelectTrigger: ({ children }: { children: React.ReactNode }) =>
{children}
, SelectValue: () =>
Selected
, - SelectContent: ({ children }: any) =>
{children}
, - SelectItem: ({ children, value }: any) =>
{children}
, + SelectContent: ({ children }: { children: React.ReactNode }) =>
{children}
, + SelectItem: ({ children, value }: { children: React.ReactNode; value: string }) => ( +
{children}
+ ), })); vi.mock("@xtablo/ui/components/typography", () => ({ - TypographyMuted: ({ children }: any) =>
{children}
, - TypographyP: ({ children }: any) =>

{children}

, + TypographyMuted: ({ children }: { children: React.ReactNode }) =>
{children}
, + TypographyP: ({ children }: { children: React.ReactNode }) =>

{children}

, })); vi.mock("react-i18next", () => ({ @@ -147,5 +168,3 @@ describe("EmbedConfigModal", () => { expect(mockBuildPublicLink).toHaveBeenCalled(); }); }); - - diff --git a/apps/main/src/components/EventDetailsModal.test.tsx b/apps/main/src/components/EventDetailsModal.test.tsx index 35896b8..9e7bd0d 100644 --- a/apps/main/src/components/EventDetailsModal.test.tsx +++ b/apps/main/src/components/EventDetailsModal.test.tsx @@ -1,10 +1,19 @@ import { fireEvent, render, screen } from "@testing-library/react"; +import type { EventAndTablo } from "@xtablo/shared/types/events.types"; import { describe, expect, it, vi } from "vitest"; import { EventDetailsModal } from "./EventDetailsModal"; // Mock CustomModal vi.mock("./CustomModal", () => ({ - CustomModal: ({ isOpen, children, title }: any) => + CustomModal: ({ + isOpen, + children, + title, + }: { + isOpen: boolean; + children: React.ReactNode; + title: string; + }) => isOpen ? (
{title}
@@ -30,7 +39,10 @@ describe("EventDetailsModal", () => { description: "Test description", tablo_name: "Test Tablo", tablo_color: "bg-blue-500", - } as any; + tablo_id: "tablo-1", + tablo_status: "active", + event_id: "event-1", + } as EventAndTablo; const mockOnClose = vi.fn(); const mockOnEdit = vi.fn(); @@ -140,5 +152,3 @@ describe("EventDetailsModal", () => { expect(screen.queryByText("eventDetailsModal.labels.description")).not.toBeInTheDocument(); }); }); - - diff --git a/apps/main/src/components/EventModal.test.tsx b/apps/main/src/components/EventModal.test.tsx index 5e3a7ec..f7ce678 100644 --- a/apps/main/src/components/EventModal.test.tsx +++ b/apps/main/src/components/EventModal.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from "@testing-library/react"; +import { screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { renderWithProviders } from "../utils/testHelpers"; import { EventModal } from "./EventModal"; @@ -30,7 +30,7 @@ vi.mock("../hooks/tablos", () => ({ vi.mock("../providers/UserStoreProvider", () => ({ useUser: () => ({ id: "user-1", name: "Test User" }), useIsReadOnlyUser: () => false, - TestUserStoreProvider: ({ children }: any) => children, + TestUserStoreProvider: ({ children }: { children: React.ReactNode }) => children, })); vi.mock("react-i18next", () => ({ diff --git a/apps/main/src/components/EventTypeCard.test.tsx b/apps/main/src/components/EventTypeCard.test.tsx index 9992dac..0755669 100644 --- a/apps/main/src/components/EventTypeCard.test.tsx +++ b/apps/main/src/components/EventTypeCard.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen } from "@testing-library/react"; +import { fireEvent, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; +import type { EventType } from "../hooks/event-types"; import { renderWithProviders } from "../utils/testHelpers"; import { EventTypeCard } from "./EventTypeCard"; @@ -16,7 +17,7 @@ vi.mock("../providers/UserStoreProvider", () => ({ id: "test-user-id-123", name: "Test User", }), - TestUserStoreProvider: ({ children }: any) => children, + TestUserStoreProvider: ({ children }: { children: React.ReactNode }) => children, })); vi.mock("../lib/env", () => ({ @@ -31,7 +32,7 @@ vi.mock("react-i18next", () => ({ })); describe("EventTypeCard", () => { - const mockEventType = { + const mockEventType: EventType = { id: "1", name: "30 Min Meeting", duration: 30, @@ -40,6 +41,8 @@ describe("EventTypeCard", () => { bufferTime: 10, maxBookingsPerDay: 5, minAdvanceBooking: { value: 1, unit: "hours" as const }, + requiresApproval: false, + description: "Test description", }; const handleEditEventType = vi.fn(); @@ -68,7 +71,7 @@ describe("EventTypeCard", () => { ); expect(screen.getByText("eventTypeCard.duration")).toBeInTheDocument(); // Duration is displayed as "30 eventTypeCard.minutes" - const durationElements = screen.getAllByText((content, element) => { + const durationElements = screen.getAllByText((_content, element) => { return ( (element?.textContent?.includes("30") && element?.textContent?.includes("eventTypeCard.minutes")) || diff --git a/apps/main/src/components/EventTypeModal.test.tsx b/apps/main/src/components/EventTypeModal.test.tsx index b0074a3..91417de 100644 --- a/apps/main/src/components/EventTypeModal.test.tsx +++ b/apps/main/src/components/EventTypeModal.test.tsx @@ -5,46 +5,69 @@ import { EventTypeModal } from "./EventTypeModal"; // Mock Dialog components vi.mock("@xtablo/ui/components/dialog", () => ({ - Dialog: ({ open, children }: any) => (open ?
{children}
: null), - DialogContent: ({ children }: any) =>
{children}
, - DialogHeader: ({ children }: any) =>
{children}
, - DialogTitle: ({ children }: any) =>

{children}

, - DialogFooter: ({ children }: any) =>
{children}
, + Dialog: ({ open, children }: { open: boolean; children: React.ReactNode }) => + open ?
{children}
: null, + DialogContent: ({ children }: { children: React.ReactNode }) =>
{children}
, + DialogHeader: ({ children }: { children: React.ReactNode }) =>
{children}
, + DialogTitle: ({ children }: { children: React.ReactNode }) =>

{children}

, + DialogFooter: ({ children }: { children: React.ReactNode }) =>
{children}
, })); // Mock other components vi.mock("@xtablo/ui/components/button", () => ({ - Button: ({ children, onClick }: any) => , -})); - -vi.mock("@xtablo/ui/components/input", () => ({ - Input: ({ value, onChange, type }: any) => ( - + Button: ({ children, onClick }: { children: React.ReactNode; onClick: () => void }) => ( + ), })); +vi.mock("@xtablo/ui/components/input", () => ({ + Input: ({ + value, + onChange, + type, + }: { + value: string; + onChange: (e: React.ChangeEvent) => void; + type: string; + }) => , +})); + vi.mock("@xtablo/ui/components/label", () => ({ - Label: ({ children }: any) => , + Label: ({ children }: { children: React.ReactNode }) => , })); vi.mock("@xtablo/ui/components/textarea", () => ({ - Textarea: ({ value, onChange }: any) =>