import { describe, expect, it } from "vitest";
import { render, screen } from "@testing-library/react";
import { axe } from "vitest-axe";
import { AvatarGroup } from "./AvatarGroup";
describe("AvatarGroup", () => {
const data = [
{ initials: "MD", alt: "Marie" },
{ initials: "JM", alt: "Jean" },
{ initials: "SB", alt: "Sophie" },
{ initials: "TL", alt: "Thomas" },
{ initials: "ER", alt: "Emma" },
{ initials: "LB", alt: "Lohann" },
];
it("limite l'affichage à max", () => {
render();
expect(screen.getByText("+3")).toBeInTheDocument();
expect(screen.getByLabelText(/3 autres/)).toBeInTheDocument();
});
it("respecte le total custom", () => {
render();
expect(screen.getByText("+9")).toBeInTheDocument();
});
it("expose role group", () => {
render();
expect(screen.getByRole("group")).toBeInTheDocument();
});
it("a11y axe-core", async () => {
const { container } = render();
expect(await axe(container)).toHaveNoViolations();
});
});