Case com mídia ao lado do título e play acessível; problema de cada cliente reescrito com base nos dados; serviços relacionados em 2 cards; FAQ antes do próximo passo e bloco 'Onde já apliquei isso'; Apolo citada em IoT e arquitetura. metaTitle até 43 caracteres e descrições até 155 com teste; JSON-LD CreativeWork; imagens de compartilhamento abaixo de 100 KB; 404 e robots corrigidos; server-only nos módulos com node:.
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { getRelatedServices } from "@/lib/site-content";
|
|
import { CaseContactSection } from "./CaseContactSection";
|
|
|
|
/**
|
|
* Testes de caminhos-base de CaseContactSection: o convite de um case de cliente ("projeto parecido") e o de
|
|
* um projeto de laboratório ("problema parecido"), o link para a lista de cases e os serviços ligados.
|
|
*/
|
|
|
|
const sev = { id: "sev-modaintima", title: "SEV Moda Íntima" };
|
|
const nutri = { id: "nutriscan", title: "NutriScan" };
|
|
|
|
function messageOf(link: HTMLElement) {
|
|
return new URL(link.getAttribute("href") ?? "").searchParams.get("text");
|
|
}
|
|
|
|
describe("CaseContactSection", () => {
|
|
it("path: client case -> 'projeto parecido' invitation, WhatsApp with the case title, services listed", () => {
|
|
render(<CaseContactSection caseStudy={sev} isClient />);
|
|
|
|
expect(
|
|
screen.getByRole("heading", {
|
|
level: 2,
|
|
name: "Quer um projeto parecido com este?",
|
|
}),
|
|
).toBeVisible();
|
|
const cta = screen.getByRole("link", {
|
|
name: "Conversar sobre um projeto parecido",
|
|
});
|
|
expect(cta).toHaveAttribute("target", "_blank");
|
|
expect(messageOf(cta)).toContain(
|
|
`Quero conversar sobre um projeto parecido com o da ${sev.title}.`,
|
|
);
|
|
expect(getRelatedServices(sev.id).length).toBeGreaterThan(0);
|
|
expect(
|
|
screen.getAllByRole("link", { name: /^Ver o serviço:/ }).length,
|
|
).toBeGreaterThan(0);
|
|
expect(
|
|
screen.getByRole("link", { name: "Ver outros cases" }),
|
|
).toHaveAttribute("href", "/cases");
|
|
});
|
|
|
|
it("path: laboratory case -> 'problema parecido' invitation and no mention of a similar project", () => {
|
|
render(<CaseContactSection caseStudy={nutri} isClient={false} />);
|
|
|
|
expect(
|
|
screen.getByRole("heading", { level: 2, name: "Fale sobre o seu caso" }),
|
|
).toBeVisible();
|
|
const cta = screen.getByRole("link", {
|
|
name: "Tem um problema parecido? Vamos conversar.",
|
|
});
|
|
expect(messageOf(cta)).toContain(
|
|
`Quero conversar sobre um problema parecido com o do projeto ${nutri.title}.`,
|
|
);
|
|
expect(
|
|
screen.queryByRole("link", {
|
|
name: "Conversar sobre um projeto parecido",
|
|
}),
|
|
).toBeNull();
|
|
// o NutriScan não é citado por nenhum serviço: sem cartões, o convite continua
|
|
expect(getRelatedServices(nutri.id)).toHaveLength(0);
|
|
expect(screen.queryByRole("link", { name: /^Ver o serviço:/ })).toBeNull();
|
|
expect(
|
|
screen.getByRole("link", { name: "Ver outros cases" }),
|
|
).toBeVisible();
|
|
});
|
|
});
|