feat(servicos): topo, entregáveis e cases por serviço, assunto próprio no WhatsApp e títulos curtos
This commit is contained in:
1 parent
cf360041bd
commit
2fd8b063d9
33 files changed
+1578
-300
No files matched your search
@@ -0,0 +1,75 @@
|
||||
import { render, screen, within } from "@testing-library/react";
|
||||
import { setNavigation } from "@/__mocks__/next/navigation";
|
||||
import { type CaseStudyContent, caseStudies } from "@/lib/site-content";
|
||||
import { ServiceAlsoCases } from "./ServiceAlsoCases";
|
||||
|
||||
/**
|
||||
* ServiceAlsoCases (CC 3): sem case (nada) | com case; frase de relação própria | só o resumo do case.
|
||||
*/
|
||||
|
||||
beforeEach(() => {
|
||||
setNavigation({ pathname: "/servicos" });
|
||||
});
|
||||
|
||||
function getCase(id: string): CaseStudyContent {
|
||||
const found = caseStudies.find((item) => item.id === id);
|
||||
if (!found) throw new Error(`Missing case ${id}`);
|
||||
return found;
|
||||
}
|
||||
|
||||
describe("ServiceAlsoCases", () => {
|
||||
it("path: cases with a relation sentence -> one line per case, with the title, the sentence and a 'Ver case' link, and no cover", () => {
|
||||
render(
|
||||
<ServiceAlsoCases
|
||||
title="Também faço sites institucionais"
|
||||
cases={[getCase("sc-plus"), getCase("as-servicos")]}
|
||||
relevance={{
|
||||
"sc-plus": "Frase do SC Plus.",
|
||||
"as-servicos": "Frase da AS.",
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("heading", {
|
||||
level: 2,
|
||||
name: "Também faço sites institucionais",
|
||||
}),
|
||||
).toBeVisible();
|
||||
const rows = screen.getAllByRole("listitem");
|
||||
expect(rows).toHaveLength(2);
|
||||
expect(
|
||||
within(rows[0]).getByRole("heading", {
|
||||
level: 3,
|
||||
name: "SC Plus Aquicultura",
|
||||
}),
|
||||
).toBeVisible();
|
||||
expect(within(rows[0]).getByText("Frase do SC Plus.")).toBeVisible();
|
||||
expect(
|
||||
within(rows[0]).getByRole("link", {
|
||||
name: "Ver case SC Plus Aquicultura",
|
||||
}),
|
||||
).toHaveAttribute("href", "/cases/sc-plus");
|
||||
expect(
|
||||
within(rows[1]).getByRole("link", { name: "Ver case AS Serviços" }),
|
||||
).toHaveAttribute("href", "/cases/as-servicos");
|
||||
expect(screen.queryByRole("img")).toBeNull();
|
||||
});
|
||||
|
||||
it("path: no relation sentence for a case -> the summary of the case stands in", () => {
|
||||
const caseStudy = getCase("sc-plus");
|
||||
render(
|
||||
<ServiceAlsoCases title="Também" cases={[caseStudy]} relevance={{}} />,
|
||||
);
|
||||
|
||||
expect(screen.getByText(caseStudy.summary)).toBeVisible();
|
||||
});
|
||||
|
||||
it("path: no case -> renders nothing", () => {
|
||||
const { container } = render(
|
||||
<ServiceAlsoCases title="Também" cases={[]} relevance={{}} />,
|
||||
);
|
||||
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user