Plano de negócio: objectivos, missão e chaves para o sucesso no passo 1, com ajuda própria
tests / ci (push) Canceled after 0s

Os três campos do resumo executivo apareciam no passo «Clientes e mercado»,
porque os dois percursos guiados escolhem os campos de cada passo por lista.
Passam a seguir o «Resumo executivo» no passo 1, e o painel de ajuda deixa
de mostrar o texto genérico para eles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
Claude
2026-12-04 21:51:20 +02:00
committed by nala
parent 2c03a0091e
commit ceba77436b
4 changed files with 70 additions and 0 deletions
@@ -145,3 +145,39 @@ void test("the same missing classification for many months is one line with the
assert.equal(lines.length, 1);
assert.match(lines[0].message, /— meses 1 a 36:/);
});
void test("the executive summary fields follow the summary in step 1 of the guided journey, with their own help (Criar Hotel)", async () => {
const { simulationFieldsForSection } = await import("../../resources/js/lib/simulation-form.ts");
const { formFieldGuidance } = await import("../../resources/js/lib/form-help.ts");
// Guided investment journey: steps come from the library.
const draft = {
journey_type: "investor",
detail_level: "simple",
purpose: "own_investment",
preferred_language: "pt-MZ",
project_title: "Criar Hotel",
};
const step1 = simulationFieldsForSection(draft, "purpose").map((f) => f.key);
const at = step1.indexOf("project_summary");
assert.deepEqual(step1.slice(at, at + 4), [
"project_summary",
"plan_objectives",
"plan_mission",
"plan_success_keys",
]);
const step2 = simulationFieldsForSection(draft, "market").map((f) => f.key);
assert.ok(!step2.some((k) => k.startsWith("plan_")));
for (const label of ["Objectivos do negócio", "Missão", "Chaves para o sucesso"])
assert.doesNotMatch(
formFieldGuidance({ label, type: "textarea", required: false }).instruction,
/Explique a informação pedida/,
);
// Small-business journey: the component lists step 1 and step 2 itself.
const fs = await import("node:fs");
const component = fs.readFileSync(
new URL("../../resources/js/components/simulation-form.tsx", import.meta.url),
"utf8",
);
const lists = [...component.matchAll(/'project_summary',\s*'plan_objectives',\s*'plan_mission',\s*'plan_success_keys',/g)];
assert.equal(lists.length, 2);
});