import { render, screen } from "@testing-library/react";
import type { Testimonial } from "@/lib/proof";
import { testimonials } from "@/lib/proof";
import Testimonials from "./Testimonials";
const item: Testimonial = {
quote: "Entregou no prazo combinado.",
name: "Maria Souza",
role: "Sócia",
company: "Empresa de Teste",
projectId: "lavacao-047",
};
it("renders nothing without testimonials", () => {
const { container } = render();
expect(container).toBeEmptyDOMElement();
const withoutProp = render();
expect(withoutProp.container).toBeEmptyDOMElement();
});
it("ships with no testimonial until a real, authorized one is added", () => {
expect(testimonials).toEqual([]);
});
it("shows the quote, who said it and a link to the case", () => {
render();
expect(
screen.getByRole("heading", { name: "O que dizem os clientes." }),
).toBeInTheDocument();
expect(
screen.getByText("“Entregou no prazo combinado.”"),
).toBeInTheDocument();
expect(screen.getByText("Maria Souza")).toBeInTheDocument();
expect(screen.getByText("Sócia, Empresa de Teste")).toBeInTheDocument();
expect(screen.getByRole("link", { name: "Ver case" })).toHaveAttribute(
"href",
"/cases/lavacao-047",
);
});
it("falls back to initials without a photo and has no case link without a project", () => {
render();
expect(screen.getByText("MS")).toBeInTheDocument();
expect(screen.queryByRole("link", { name: "Ver case" })).toBeNull();
});