import fs from 'node:fs/promises'; import crypto from 'node:crypto'; import assert from 'node:assert/strict'; const file = 'docs/proofs/public-demonstration-frontend.json'; const proof = JSON.parse(await fs.readFile(file, 'utf8')); const queue = Object.entries(proof.files); let checked = 0; await Promise.all(Array.from({ length: 4 }, async () => { for (;;) { const entry = queue.shift(); if (!entry) return; const [name, hash] = entry; const response = await fetch('https://compras.tempo.co.mz/build/' + name, { signal: AbortSignal.timeout(20000) }); assert.equal(response.status, 200, name); assert.equal(crypto.createHash('sha256').update(new Uint8Array(await response.arrayBuffer())).digest('hex'), hash, name); checked++; } })); Object.assign(proof, { state: 'assets_passed_banner_pending', public_assets_responses_and_hashes: checked }); await fs.writeFile(file, JSON.stringify(proof, null, 2) + '\n'); const response = await fetch('https://compras.tempo.co.mz/login', { signal: AbortSignal.timeout(15000) }); assert.equal(response.status, 200); const html = await response.text(); const manifest = JSON.parse(await fs.readFile('storage/framework/testing/compras-presentation-final-ui-20261129/manifest.json', 'utf8')); assert.ok(html.includes(manifest['resources/js/app.tsx'].file)); assert.ok(html.includes('Empresa e dados fictícios')); Object.assign(proof, { state: 'passed', date: new Date().toISOString(), public_entry_current: true, demonstration_banner_present: true }); await fs.writeFile(file, JSON.stringify(proof, null, 2) + '\n'); console.log(JSON.stringify({ state: proof.state, public_assets_responses_and_hashes: checked, public_entry_current: true }));