import { render, screen } from "@testing-library/react"; import { Title } from "."; describe("Title", () => { it("should render the correct title", () => { render(); expect(screen.getByText("General Liability")).toBeInTheDocument(); }); it("should render the correct description", () => { render(<Title title="General Liability" description="Business Co." />); expect(screen.getByText("Business Co.")).toBeInTheDocument(); }); describe("given elementType", () => { it("is not applied as element attribute", () => { const { container } = render( <Title title="General Liability" description="Business Co." elementType="ul" />, ); expect(container.firstChild).not.toHaveAttribute("elementtype", "ul"); }); }); });