Files
portifolio-evandrodevbr/app/curriculo/page.test.tsx
T
Evandro Fonseca Junior de6af74a0c feat(cases): prova certa por serviço, páginas internas com trabalho no topo
Diagnóstico sem case que não cabe; desktop com o GCC Installer como projeto próprio; IoT com o Twins Lab e a nota da Apolo. Mosaico de pôsteres em /servicos e /cases, faixa baixa em uma coluna no currículo, privacidade e laboratório; Laboratório como lista compacta; SEV começando por catálogo, pedido no WhatsApp e painel; Joinville e SC nos títulos; imagens do LCP com fetchPriority e sizes reais; pré-carregamento só no hover; 404 com Open Graph próprio.
2026-10-14 17:01:35 -03:00

97 lines
3.6 KiB
TypeScript

import { fireEvent, render, screen, within } from "@testing-library/react";
import { trackCvDownload } from "@/lib/analytics";
import CurriculoPage, { metadata } from "./page";
jest.mock("@/lib/analytics", () => ({ trackCvDownload: jest.fn() }));
it("uses the same shell as the home, with no narrow max-width, and a template-friendly title", () => {
const { container } = render(CurriculoPage());
const shells = container.querySelectorAll(".ds-section-shell");
expect(shells.length).toBeGreaterThan(0);
for (const shell of shells) {
expect(shell.className).not.toMatch(/max-w-/);
}
// o sufixo " | Evandro.dev.br" vem do layout: o título não o repete
expect(metadata.title).toBe("Currículo de Evandro Fonseca Junior");
expect(metadata.alternates?.canonical).toBe(
"https://evandro.dev.br/curriculo",
);
});
it("shows the Innovo company name with the right accents", () => {
render(CurriculoPage());
expect(
screen.getByText(/Innovo Tecnologia da Informação Ltda\./),
).toBeVisible();
expect(document.body.textContent).not.toMatch(/Informacao/);
});
it("shows a matching breadcrumb and keeps consulting secondary to hiring", () => {
render(CurriculoPage());
const breadcrumb = screen.getByRole("navigation", {
name: "Trilha de navegação",
});
const breadcrumbLinks = within(breadcrumb).getAllByRole("link");
expect(breadcrumbLinks.map((link) => link.textContent)).toEqual([
"Início",
"Currículo",
]);
expect(breadcrumbLinks[0]).toHaveAttribute("href", "/");
expect(breadcrumbLinks[1]).toHaveAttribute("href", "/curriculo");
expect(breadcrumbLinks[1]).toHaveAttribute("aria-current", "page");
const hiringLink = screen.getByRole("link", { name: /oportunidade/i });
const consultingLink = screen.getByRole("link", { name: /consultoria/i });
expect(hiringLink).toHaveAttribute("href", "/#contact");
expect(consultingLink).toHaveAttribute("href", "/servicos");
expect(
hiringLink.compareDocumentPosition(consultingLink) &
Node.DOCUMENT_POSITION_FOLLOWING,
).toBeTruthy();
});
it("links to no GitHub profile", () => {
render(CurriculoPage());
// "GitHub Actions" continua como competência técnica; o que não pode haver é endereço do GitHub
expect(document.body.textContent).not.toMatch(/github\.com/i);
for (const link of screen.getAllByRole("link")) {
expect(link.getAttribute("href")).not.toMatch(/github/i);
}
});
it("offers the résumé PDF as a secondary action and measures the download", () => {
render(CurriculoPage());
const pdf = screen.getByRole("link", { name: "Baixar currículo em PDF" });
expect(pdf).toHaveAttribute("href", "/Profile.pdf");
expect(pdf).toHaveAttribute("download", "Evandro_Fonseca_Junior_CV.pdf");
// limão só para o contato
expect(pdf).not.toHaveClass("ds-link-accent");
expect(screen.getByRole("link", { name: /oportunidade/i })).toHaveClass(
"ds-link-accent",
);
fireEvent.click(pdf);
expect(trackCvDownload).toHaveBeenCalledWith({ placement: "curriculo" });
});
it("opens with a lower one-column strip, the location line and spaced achievement lists", () => {
const { container } = render(CurriculoPage());
const hero = container.querySelector("section");
expect(hero?.className).toContain("md:!pb-sp-12");
expect(hero?.querySelector(".ds-section-shell")).not.toHaveClass("grid");
expect(hero).toHaveTextContent(
"Garuva e Joinville (SC) · atendimento remoto em todo o Brasil",
);
const achievements = container.querySelectorAll("article.ds-card ul.ds-list");
expect(achievements.length).toBeGreaterThan(0);
for (const list of achievements) {
expect(list).toHaveClass("space-y-sp-2");
}
});