xtablo-source/apps/main/src/components/TabloNotesSection.test.tsx
Arthur Belleville 50971fbc3a
Add tests
2025-10-27 10:29:59 +01:00

49 lines
1.2 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import { renderWithProviders } from "../utils/testHelpers";
import { TabloNotesSection } from "./TabloNotesSection";
// 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("react-i18next", () => ({
useTranslation: () => ({
t: (key: string) => key,
}),
}));
vi.mock("../hooks/notes", () => ({
useTabloNotes: () => ({
notes: [],
isLoading: false,
}),
}));
describe("TabloNotesSection", () => {
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(
<TabloNotesSection tablo={mockTablo} isAdmin={true} />
);
expect(container).toBeInTheDocument();
});
});