import { describe, expect, it, vi } from "vitest";
import { renderWithProviders } from "../utils/testHelpers";
import { TabloSettingsSection } from "./TabloSettingsSection";

// Mock hooks
vi.mock("react-router-dom", async () => {
  const actual = await vi.importActual("react-router-dom");
  return {
    ...actual,
    useParams: () => ({ tablo_id: "test-tablo-id" }),
    useNavigate: () => vi.fn(),
  };
});

vi.mock("../hooks/tablos", () => ({
  useUpdateTablo: () => ({
    mutate: vi.fn(),
  }),
  useDeleteTablo: () => ({
    mutate: vi.fn(),
  }),
  useTabloMembers: () => ({
    data: [],
  }),
}));

describe("TabloSettingsSection", () => {
  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,
  };

  const mockOnEdit = vi.fn();

  it("renders without crashing", () => {
    const { container } = renderWithProviders(
      <TabloSettingsSection tablo={mockTablo} isAdmin={true} onEdit={mockOnEdit} />
    );
    expect(container).toBeInTheDocument();
  });
});
