import test from 'node:test'; import assert from 'node:assert/strict'; import JSZip from 'jszip'; import { createProjectDossierReport, createProjectDossierPrintHtml, generateProjectDossierDocx, } from '../../resources/js/lib/project-dossier-report.ts'; const text = 'Objectivos: testar uma procura declarada. Missao: prestar um servico local. Chaves para o sucesso: qualidade e cumprimento dos prazos.'; const make = () => createProjectDossierReport( { project_title: 'SYNTHETIC narrative QA', project_summary: text, competitor_assumption: 'SYNTHETIC & alternatives', }, { selectedSections: new Set(['summary', 'project', 'market']), generatedAt: '2026-11-21T10:00:00Z', }, ); void test('F23 preserves investor executive objectives, mission and success keys without adopting TEMPO examples', () => { const r = make(); assert.equal( r.sections.find((s) => s.id === 'summary').paragraphs[0], text, ); assert.ok( !r.sections .find((s) => s.id === 'summary') .paragraphs[0].includes('TEMPO'), ); }); void test('F26 exports nonfinancial rows as escaped paragraphs in HTML and Word without losing values and provenance', async () => { const r = make(), before = JSON.stringify(r); const html = await createProjectDossierPrintHtml(r, [], true); assert.doesNotMatch(html, /alert')); const zip = await JSZip.loadAsync( await (await generateProjectDossierDocx(r, [], true)).arrayBuffer(), ); const xml = await zip.file('word/document.xml').async('string'); assert.doesNotMatch(xml, / { const r = make(); r.sections.push({ id: 'finance', title: 'SYNTHETIC finance', private: true, paragraphs: [], rows: [ { field: 'SYNTHETIC preserved amount', value: '100.00 MZN', classification: 'Declared', origin: 'Synthetic input', }, ], tables: [ { id: 'synthetic-core', title: 'SYNTHETIC core table', headers: ['Month', 'Cash'], rows: [['1', '100.00']], notes: [], issues: [], }, ], }); const html = await createProjectDossierPrintHtml(r, [], true); assert.equal((html.match(/