feat(servicos): ofertas no topo de /servicos, capa por assunto e diagramas
/servicos abre com as 3 ofertas e depois outros serviços; H1 de criação de sites e de engenharia com o nome da oferta; capa de cada serviço pelo assunto (SEV fora do próprio case cai de ~11 para 2 imagens); diagrama de fluxo em SVG nos serviços sem case; cases com o que o cliente passou a poder fazer e contato logo depois de Como ficou; FAQ num componente só; lastmod por rota; ProfessionalService com areaServed.
This commit is contained in:
1 parent
e63f3c2ebd
commit
fc44a69fb3
41 files changed
+2486
-550
No files matched your search
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Testes de caminhos-base da ordem de `clientCasesForListing` (lib/site-content.ts), com a lista de projetos de
|
||||
* cliente trocada por um dublê de `isClientProject`.
|
||||
*
|
||||
* listingRank (CC 2): o id está em `clientListingOrder` (a posição dele) | não está (o fim, depois de todos). O
|
||||
* `sort` é estável: os que não estão na lista ficam na ordem em que `caseStudies` os traz.
|
||||
* Os dados reais só têm os quatro clientes da lista; o caminho do cliente fora da lista só existe aqui.
|
||||
*/
|
||||
|
||||
const LISTED = ["lavacao-047", "sc-plus", "as-servicos", "sev-modaintima"];
|
||||
|
||||
function loadWithClients(clientIds: readonly string[] | "all") {
|
||||
let loaded: typeof import("./site-content") | undefined;
|
||||
jest.isolateModules(() => {
|
||||
jest.doMock("./proof", () => ({
|
||||
...jest.requireActual("./proof"),
|
||||
isClientProject: ({ id }: { id: string }) =>
|
||||
clientIds === "all" || clientIds.includes(id),
|
||||
}));
|
||||
loaded = require("./site-content");
|
||||
});
|
||||
jest.dontMock("./proof");
|
||||
if (!loaded) throw new Error("site-content não carregou");
|
||||
return loaded;
|
||||
}
|
||||
|
||||
describe("clientCasesForListing: ordem", () => {
|
||||
it("path: only listed clients -> the fixed order, the SEV last, whatever order the cases come in", () => {
|
||||
const { clientCasesForListing, clientCases } = loadWithClients(LISTED);
|
||||
|
||||
expect(clientCasesForListing.map(({ id }) => id)).toEqual(LISTED);
|
||||
expect(clientCasesForListing).toHaveLength(clientCases.length);
|
||||
});
|
||||
|
||||
it("path: a client that is not in the order list -> goes after all the listed ones, the SEV included", () => {
|
||||
const { clientCasesForListing, caseStudies } = loadWithClients([
|
||||
...LISTED,
|
||||
"gcc-installer",
|
||||
]);
|
||||
if (!caseStudies.some(({ id }) => id === "gcc-installer"))
|
||||
throw new Error("Missing gcc-installer case");
|
||||
|
||||
expect(clientCasesForListing.map(({ id }) => id)).toEqual([
|
||||
...LISTED,
|
||||
"gcc-installer",
|
||||
]);
|
||||
});
|
||||
|
||||
it("path: several clients outside the list -> they keep the order of caseStudies among themselves (stable sort)", () => {
|
||||
const { clientCasesForListing, caseStudies } = loadWithClients("all");
|
||||
|
||||
const unlisted = clientCasesForListing
|
||||
.map(({ id }) => id)
|
||||
.filter((id) => !LISTED.includes(id));
|
||||
expect(unlisted.length).toBeGreaterThan(1);
|
||||
expect(unlisted).toEqual(
|
||||
caseStudies.map(({ id }) => id).filter((id) => !LISTED.includes(id)),
|
||||
);
|
||||
expect(
|
||||
clientCasesForListing.slice(0, LISTED.length).map(({ id }) => id),
|
||||
).toEqual(LISTED);
|
||||
});
|
||||
|
||||
it("path: no client at all -> an empty list, no crash", () => {
|
||||
const { clientCasesForListing } = loadWithClients([]);
|
||||
|
||||
expect(clientCasesForListing).toEqual([]);
|
||||
});
|
||||
|
||||
it("path: the real data -> the SEV is the last client, as the mosaic and /cases expect", () => {
|
||||
jest.resetModules();
|
||||
const { clientCasesForListing } =
|
||||
jest.requireActual<typeof import("./site-content")>("./site-content");
|
||||
|
||||
expect(clientCasesForListing.at(-1)?.id).toBe("sev-modaintima");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user