Aplicar Pint e formatação de frontend; delimitar o âmbito do lint
Só formatação automática (pint, vp check --fix), sem alterar comportamento. Excluídos da formatação os registos e artefactos com bytes fixos: docs/, integrations/, storage/, tmp/, output/, resources/data/, tests/Fixtures/, compras-release.json e AGENTS*.md. Scripts operacionais, integrations e auxiliares de teste ficam fora do lint (usam new Function; limpeza na fase 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,35 +4,72 @@ import assert from 'node:assert/strict';
|
||||
|
||||
const release = JSON.parse(await fs.readFile('compras-release.json', 'utf8'));
|
||||
const base = 'https://compras.tempo.co.mz';
|
||||
const entry = await fetch(base+'/', { redirect: 'manual', signal: AbortSignal.timeout(15000) });
|
||||
const entry = await fetch(base + '/', {
|
||||
redirect: 'manual',
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
assert.equal(entry.status, 302);
|
||||
assert.equal(new URL(entry.headers.get('location'), base).pathname, '/login');
|
||||
const queue = Object.entries(release.frontend.files);
|
||||
let checked = 0;
|
||||
await Promise.all(Array.from({ length: 4 }, async () => {
|
||||
for (;;) {
|
||||
const entry = queue.shift();
|
||||
if (!entry) return;
|
||||
const [name, expected] = entry;
|
||||
const response = await fetch(base+'/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'), expected, name);
|
||||
checked++;
|
||||
}
|
||||
}));
|
||||
for (const [path, component] of [['/', 'auth/login'], ['/login', 'auth/login'], ['/apresentacao', 'home']]) {
|
||||
const response = await fetch(base+path, { signal: AbortSignal.timeout(15000) });
|
||||
await Promise.all(
|
||||
Array.from({ length: 4 }, async () => {
|
||||
for (;;) {
|
||||
const entry = queue.shift();
|
||||
if (!entry) return;
|
||||
const [name, expected] = entry;
|
||||
const response = await fetch(base + '/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'),
|
||||
expected,
|
||||
name,
|
||||
);
|
||||
checked++;
|
||||
}
|
||||
}),
|
||||
);
|
||||
for (const [path, component] of [
|
||||
['/', 'auth/login'],
|
||||
['/login', 'auth/login'],
|
||||
['/apresentacao', 'home'],
|
||||
]) {
|
||||
const response = await fetch(base + path, {
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
assert.equal(response.status, 200);
|
||||
const html = await response.text();
|
||||
assert.ok(html.includes(release.frontend.entry));
|
||||
const bootstrap = html.match(/<script data-page="app" type="application\/json">([\s\S]*?)<\/script>/);
|
||||
const bootstrap = html.match(
|
||||
/<script data-page="app" type="application\/json">([\s\S]*?)<\/script>/,
|
||||
);
|
||||
assert.ok(bootstrap);
|
||||
const page = JSON.parse(bootstrap[1]);
|
||||
assert.equal(page.component, component);
|
||||
assert.equal(page.props.auth.user, null);
|
||||
assert.deepEqual(page.props.commonFinanceNavigation, { payments: false, ledger: false, configuration: false });
|
||||
assert.deepEqual(page.props.commonFinanceNavigation, {
|
||||
payments: false,
|
||||
ledger: false,
|
||||
configuration: false,
|
||||
});
|
||||
}
|
||||
const proof = { state: 'passed', product: 'compras', release_id: release.release_id, public_url: base,
|
||||
assets_verified: checked, real_product_entry: true, login_entry: true, anonymous_private_identity_or_financial_access: false };
|
||||
await fs.writeFile('docs/proofs/compras-release-http.json', JSON.stringify(proof, null, 2)+'\n');
|
||||
const proof = {
|
||||
state: 'passed',
|
||||
product: 'compras',
|
||||
release_id: release.release_id,
|
||||
public_url: base,
|
||||
assets_verified: checked,
|
||||
real_product_entry: true,
|
||||
login_entry: true,
|
||||
anonymous_private_identity_or_financial_access: false,
|
||||
};
|
||||
await fs.writeFile(
|
||||
'docs/proofs/compras-release-http.json',
|
||||
JSON.stringify(proof, null, 2) + '\n',
|
||||
);
|
||||
console.log(JSON.stringify(proof));
|
||||
|
||||
Reference in New Issue
Block a user