import { render, screen } from "@testing-library/react"; import { Typography, TypographyType, TypographyVariant, TypographyWeight, } from "../../components/Typography/Typography"; import { axe } from "jest-axe"; describe("Switch", () => { test("Should render component correctly.", () => { const { container } = render(Typography); expect(container.firstChild).toMatchSnapshot(); }); }); describe("Accessibility", () => { test("Should have no accessibility violations.", async () => { const { container } = render(Typography); const results = await axe(container); expect(results).toHaveNoViolations(); }); }); describe("Props", () => { test.each(["h1", "h2", "h3"])( "Should render type correctly.", (type) => { render(Typography); expect(screen.getByText("Typography")).toHaveClass( `typography${type}` ); } ); test.each(["primary", "secondary"])( "Should render variant correctly.", (variant) => { render(Typography); expect(screen.getByText("Typography")).toHaveClass(variant); } ); test.each(["light", "normal", "bold"])( "Should render weight correctly.", (weight) => { render(Typography); expect(screen.getByText("Typography")).toHaveClass(weight); } ); });