Files
Investidor-V2/tools/education-review-preparation-proof.mjs
T
2026-11-11 08:21:56 +02:00

18 lines
1.6 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
import { harness,props,text } from '../tests/frontend/helpers/education-review.mjs';
const out=new URL('../outputs/education-review-preparation-20261111/',import.meta.url);
const source=JSON.parse(fs.readFileSync(new URL('recovered-page.json',out),'utf8'));
assert.equal(source.synthetic,true);
const h=harness(props(source.props));
assert.equal(h.sent.length,0);
h.click('Recuperar preparação guardada');
await h.preparationResponse(source.props.preparation);
assert.equal(h.sent.length,0);
assert.match(text(h.tree),/Revisão registada/);
assert.match(h.field('education-review','Justificação e evidência da revisão').props.value,/later edit retained/);
const escape = value => String(value).replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
fs.writeFileSync(new URL('recovered-review.html',out), '<!doctype html><meta charset="utf-8"><title>Prova de recuperação QA</title><h1>Recuperação sintética em QA</h1><p>Transcrição do componente no harness; não constitui conferência visual no navegador.</p><pre>' + escape(text(h.tree)) + '</pre>');
fs.writeFileSync(new URL('verification.json',out),JSON.stringify({synthetic:true,nativeRecoveredPage:true,actualComponent:true,privateActorBound:true,recordId:source.props.declaration.id,kind:source.props.kind,acknowledgedVersion:source.props.declaration.version_no,retainedLaterEdit:true,additionalBusinessPosts:h.sent.length,visualBrowserReview:false,activeDataChanged:false},null,2));
console.log('Native QA page recovered through actual review component; later edits retained, no duplicate decision.');