Files
manage/frontend/src/components/__tests__/SectionCard.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

28 lines
947 B
TypeScript

import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { SectionCard } from "../SectionCard";
describe("SectionCard", () => {
it("renders title, description, action, and children", () => {
render(
<SectionCard
title="Shortcuts"
description="Quick links"
action={<button type="button">Add</button>}
>
<p>Body content</p>
</SectionCard>,
);
expect(screen.getByText("Shortcuts")).toBeInTheDocument();
expect(screen.getByText("Quick links")).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Add" })).toBeInTheDocument();
expect(screen.getByText("Body content")).toBeInTheDocument();
});
it("renders without a description or action", () => {
render(<SectionCard title="Only title">children</SectionCard>);
expect(screen.getByText("Only title")).toBeInTheDocument();
expect(screen.getByText("children")).toBeInTheDocument();
});
});