import { Activity } from "lucide-react"; import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import { DashboardCard } from "@/components/dashboard/dashboard-card"; import { StatsCard } from "@/components/dashboard/stats-card"; describe("StatsCard", () => { it("renders the title and value", () => { render(); expect(screen.getByText("Visitors")).toBeInTheDocument(); expect(screen.getByText("1,234")).toBeInTheDocument(); }); it("renders an optional description and footer", () => { render( footer} />, ); expect(screen.getByText("Up 5%")).toBeInTheDocument(); expect(screen.getByText("footer")).toBeInTheDocument(); }); it("omits the icon container when no icon is provided", () => { const { container } = render(); expect(container.querySelector("svg")).toBeNull(); }); }); describe("DashboardCard", () => { it("passes its props through to a StatsCard", () => { render(); expect(screen.getByText("Sales")).toBeInTheDocument(); expect(screen.getByText("42")).toBeInTheDocument(); expect(screen.getByText("today")).toBeInTheDocument(); }); });