O botão das ofertas rola até o contato com o tipo marcado e não quebra mais as âncoras; ofertas com o que você recebe e primeiro passo, logo depois da vitrine; bloco de IA fora da home; cartão largo da SEV no hero do celular; separador da faixa de clientes só entre itens; favicon de 13 para 1,8 KB; pré-carregamento só no hover e nunca de /#... fora da home; X do menu e cabeçalho opaco; WhatsApp com "o case"; /ia com 3 passos e modelo de relatório ilustrativo; Sobre alinhado ao currículo; CSP Report-Only com os domínios do Ads.
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import type { Testimonial } from "@/lib/proof";
|
|
import Testimonials from "./Testimonials";
|
|
|
|
/**
|
|
* Testes de caminhos-base de Testimonials e de initials() (complemento de Testimonials.test.tsx):
|
|
* foto presente, iniciais com 1, 2 e 3 palavras, espaços extras, e vários depoimentos.
|
|
*/
|
|
|
|
const base: Testimonial = {
|
|
quote: "Entregou no prazo combinado.",
|
|
name: "Maria Souza",
|
|
role: "Sócia",
|
|
company: "Empresa de Teste",
|
|
};
|
|
|
|
describe("Testimonials", () => {
|
|
it("path: with a photo -> shows the decorative image and no initials", () => {
|
|
const { container } = render(
|
|
<Testimonials items={[{ ...base, photo: "/clientes/maria.jpg" }]} />,
|
|
);
|
|
|
|
const image = container.querySelector("img");
|
|
expect(image).not.toBeNull();
|
|
expect(image).toHaveAttribute("alt", "");
|
|
expect(image?.getAttribute("src")).toContain("maria");
|
|
expect(screen.queryByText("MS")).toBeNull();
|
|
});
|
|
|
|
it.each([
|
|
["Maria", "M"],
|
|
["Maria Souza", "MS"],
|
|
["maria da silva souza", "MD"],
|
|
[" Maria Souza ", "MS"],
|
|
])("path: name %j without a photo -> initials %j", (name, initials) => {
|
|
const { container } = render(<Testimonials items={[{ ...base, name }]} />);
|
|
|
|
expect(container.querySelector("img")).toBeNull();
|
|
expect(
|
|
container.querySelector("span[aria-hidden='true']"),
|
|
).toHaveTextContent(new RegExp(`^${initials}$`));
|
|
});
|
|
|
|
it("path: several testimonials -> one card each, keyed by company and name", () => {
|
|
render(
|
|
<Testimonials
|
|
items={[
|
|
base,
|
|
{ ...base, name: "João Lima", company: "Outra Empresa" },
|
|
{ ...base, name: "Maria Souza", company: "Outra Empresa" },
|
|
]}
|
|
/>,
|
|
);
|
|
|
|
expect(screen.getAllByRole("listitem")).toHaveLength(3);
|
|
expect(screen.getAllByText(/Entregou no prazo/)).toHaveLength(3);
|
|
expect(screen.getAllByText("Sócia, Outra Empresa")).toHaveLength(2);
|
|
});
|
|
|
|
it("path: a testimonial with a project -> the case link points to that project", () => {
|
|
render(<Testimonials items={[{ ...base, projectId: "sc-plus" }]} />);
|
|
|
|
expect(screen.getByRole("link", { name: "Ver case" })).toHaveAttribute(
|
|
"href",
|
|
"/cases/sc-plus",
|
|
);
|
|
});
|
|
});
|