import { render, screen } from "@testing-library/react";
import ClientStrip from "./ClientStrip";
/**
* Testes de caminhos-base de ClientStrip (complemento de ClientStrip.test.tsx): o separador entre clientes
* (um cliente, vários; só entre itens, nunca no fim de uma linha) e o className opcional.
*/
const clients = [
{ id: "sev-modaintima", name: "SEV Moda Íntima" },
{ id: "lavacao-047", name: "Lavação 047" },
{ id: "sc-plus", name: "SC Plus Aquicultura" },
];
describe("ClientStrip", () => {
it("path: a single client -> no separator dot", () => {
const { container } = render();
expect(screen.getAllByRole("link")).toHaveLength(1);
expect(container.querySelectorAll("[aria-hidden='true']")).toHaveLength(0);
});
it("path: several clients -> a separator before every client except the first", () => {
render();
const items = screen.getAllByRole("listitem");
expect(items).toHaveLength(3);
expect(
items.map((item) => item.querySelector("[aria-hidden='true']") !== null),
).toEqual([false, true, true]);
expect(items[1].querySelector("[aria-hidden='true']")).toHaveTextContent(
"·",
);
});
it("path: className given -> appended to the wrapper without a stray space", () => {
const { container } = render(
,
);
const wrapper = container.firstElementChild as HTMLElement;
expect(wrapper.className.endsWith("hero-in mt-sp-4")).toBe(true);
});
it("path: className omitted -> the wrapper class has no trailing space", () => {
const { container } = render();
const wrapper = container.firstElementChild as HTMLElement;
expect(wrapper.className).toBe(wrapper.className.trim());
});
});