feat(home): posicionamento com prova, menu sem recarregar e WhatsApp em todo o site
H1 'Sites e sistemas que trazem pedidos pelo WhatsApp e tiram sua operação da planilha.'; HeroWork maior com a SEV; menu Cases, Serviços, Como trabalho, Sobre e IA com next/link e pré-carregamento no hover; menu do celular em tela cheia; WhatsApp flutuante e no rodapé com a mensagem da rota; rodapé em todas as páginas; FAQ da home; /ia como oferta de revisão de app feito com IA; formulário com noscript, validação do mailto e plano B do pop-up; cartões sem foco indevido; sem a fonte Monument.
This commit is contained in:
1 parent
e80f73d075
commit
10f170abf4
56 files changed
+3099
-906
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import nextConfig from "../next.config";
|
||||
|
||||
/**
|
||||
* Testes de caminhos-base de headers() em next.config.ts: o que muda entre produção e desenvolvimento.
|
||||
* Produção ganha o HSTS e perde o 'unsafe-eval' da política de conteúdo (só o hot reload do dev precisa dele).
|
||||
*/
|
||||
|
||||
async function siteHeaders() {
|
||||
const rules = (await nextConfig.headers?.()) ?? [];
|
||||
const site = rules.find(({ source }) => source === "/(.*)");
|
||||
if (!site) throw new Error("Missing site-wide header rule");
|
||||
return site.headers;
|
||||
}
|
||||
|
||||
const header = (headers: { key: string; value: string }[], key: string) =>
|
||||
headers.find((item) => item.key === key)?.value;
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe("next.config headers()", () => {
|
||||
it("path: production -> HSTS is sent and the policy has no 'unsafe-eval'", async () => {
|
||||
jest.replaceProperty(process.env, "NODE_ENV", "production");
|
||||
|
||||
const headers = await siteHeaders();
|
||||
|
||||
expect(header(headers, "Strict-Transport-Security")).toBe(
|
||||
"max-age=31536000; includeSubDomains; preload",
|
||||
);
|
||||
expect(
|
||||
header(headers, "Content-Security-Policy-Report-Only"),
|
||||
).not.toContain("'unsafe-eval'");
|
||||
});
|
||||
|
||||
it("path: development or test -> no HSTS, and the policy allows 'unsafe-eval' for the dev server", async () => {
|
||||
jest.replaceProperty(process.env, "NODE_ENV", "development");
|
||||
|
||||
const headers = await siteHeaders();
|
||||
|
||||
expect(header(headers, "Strict-Transport-Security")).toBeUndefined();
|
||||
expect(header(headers, "Content-Security-Policy-Report-Only")).toContain(
|
||||
"'unsafe-eval'",
|
||||
);
|
||||
});
|
||||
|
||||
it("path: any environment -> the video rule keeps the long cache", async () => {
|
||||
const rules = (await nextConfig.headers?.()) ?? [];
|
||||
const videos = rules.find(({ source }) => source === "/videos/:path*");
|
||||
|
||||
expect(videos?.headers).toEqual([
|
||||
{
|
||||
key: "Cache-Control",
|
||||
value: "public, max-age=86400, stale-while-revalidate=604800",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user