Files
manage/frontend/src/components/__tests__/LibraryOverview.test.tsx
T
Developer 109e74db41 feat(frontend): slice 2 — migrate 11 shared components to shadcn/Tailwind
Web UI rework. Shared-components slice (drift prevention):
- Migrate SectionCard, SelectionRailCard, TabbedCard, MetricCard,
  DiskSpaceCard, HoverEditButton, DialogFooter, ConfirmDialog,
  LibraryOverview, NowPlaying, SessionActivityPanel off @mui
- HoverEditButton: MUI IconButton + EditOutlined -> Button + lucide Pencil
- Status mapping uses the success Badge variant (chart-2) for healthy
- Exported APIs preserved so consuming pages still compile (no page edits)
- 11 behavioral Vitest component tests added

Gate: build + lint + test green.
2026-06-17 12:33:47 +00:00

36 lines
1018 B
TypeScript

import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { LibraryOverview } from "../LibraryOverview";
import type { LibraryCount } from "../../types";
const libraries: LibraryCount[] = [
{
library: "Films",
type: "movies",
movies: 100,
series: 0,
episodes: 0,
total: 100,
},
{
library: "Shows",
type: "tvshows",
movies: 0,
series: 12,
episodes: 240,
total: 252,
},
];
describe("LibraryOverview", () => {
it("renders movie and TV library cards with their counts", () => {
render(<LibraryOverview libraries={libraries} />);
expect(screen.getByText("Movie libraries")).toBeInTheDocument();
expect(screen.getByText("TV libraries")).toBeInTheDocument();
expect(screen.getByText("Films")).toBeInTheDocument();
expect(screen.getByText(/Total: 100 \| Movies: 100/)).toBeInTheDocument();
expect(screen.getByText("Shows")).toBeInTheDocument();
expect(screen.getByText(/Total: 252 \| Series: 12/)).toBeInTheDocument();
});
});