import { render, screen } from "@testing-library/react";
import { Link, LinkVariant } from "../../components/Link/Link";
import { axe } from "jest-axe";
describe("Link", () => {
test("Should render component correctly.", () => {
const { container } = render(
Google.com
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe("Accessibility", () => {
test("Should have no accessibility violations.", async () => {
const { container } = render(
Google.com
);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
describe("Props", () => {
test.each(["primary", "secondary"])(
"Should render variants correctly.",
(variant) => {
render(
Google.com
);
expect(screen.getAllByRole("link")[0]).toHaveClass(variant);
}
);
});