StatCard.spec.js
16 lines
| 1 | import { render, screen } from "@testing-library/react"; |
| 2 | import StatCard from "../StatCard"; |
| 3 | |
| 4 | describe("StatCard", () => { |
| 5 | it("renders children instead of the value when children are provided", () => { |
| 6 | render( |
| 7 | <StatCard label="Engagement" value="should-not-appear"> |
| 8 | <div data-testid="custom-chart">chart</div> |
| 9 | </StatCard> |
| 10 | ); |
| 11 | expect(screen.getByTestId("custom-chart")).toBeInTheDocument(); |
| 12 | expect(screen.queryByText("should-not-appear")).not.toBeInTheDocument(); |
| 13 | }); |
| 14 | |
| 15 | }); |
| 16 |