import { h } from "preact"; import { render } from "@testing-library/preact"; import { Icon2fa } from "./src/icons.js"; describe("Preact Icon component", () => { test("should render icon component", () => { const { container } = render(); expect(container.getElementsByTagName("svg").length).toBeGreaterThan(0); }); test("should update svg attributes when there are props passed to the component", () => { const { container } = render( ); const svg = container.getElementsByTagName("svg")[0]; expect(svg.getAttribute("width")).toBe("48"); expect(svg.getAttribute("stroke")).toBe("red"); expect(svg.getAttribute("stroke-width")).toBe("4"); }); test("should match snapshot", () => { const { container } = render(); expect(container.innerHTML).toMatchInlineSnapshot( `""` ); }); });