import { TabloDiscussionSection } from "@xtablo/tablo-views";
import { describe, expect, it, vi } from "vitest";
import { renderWithProviders } from "../utils/testHelpers";

vi.mock("@xtablo/tablo-views/hooks/useChat", () => ({
  useChat: () => ({
    messages: [],
    sendMessage: vi.fn(),
    sendTyping: vi.fn(),
    isConnected: false,
    typingUsers: [],
    onlineUsers: [],
    loadMoreMessages: vi.fn(),
    hasMoreMessages: false,
    markAsRead: vi.fn(),
  }),
}));

describe("TabloDiscussionSection", () => {
  const mockTablo = {
    id: "test-tablo-id",
    name: "Test Tablo",
    color: "bg-blue-500",
    user_id: "test-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,
  };

  it("renders without crashing", () => {
    const { container } = renderWithProviders(
      <TabloDiscussionSection tablo={mockTablo} isAdmin={true} currentUserId="test-user-id" />
    );
    expect(container).toBeInTheDocument();
  });
});
