Unify institution profiles and reduce primary menu to six groups
This commit is contained in:
@@ -60,16 +60,26 @@ function load(file) {
|
||||
}
|
||||
: name === './shared'
|
||||
? { windowLabels: {} }
|
||||
: name === '@/lib/portal-api' ? {portalRequest:()=>{throw Error('Read-only rendering must not send requests');}} : name === '@/components/funding-classification'
|
||||
? load('components/funding-classification.tsx')
|
||||
: name === '@/components/funding-institution'
|
||||
? load('components/funding-institution.tsx')
|
||||
: name === '@/components/funding-dossier-choice'
|
||||
? { FundingDossierChoice: () => null }
|
||||
: name ===
|
||||
'@/components/funding-criteria-assessment'
|
||||
? load('components/funding-criteria-assessment.tsx')
|
||||
: require(name),
|
||||
: name === '@/lib/portal-api'
|
||||
? {
|
||||
portalRequest: () => {
|
||||
throw Error(
|
||||
'Read-only rendering must not send requests',
|
||||
);
|
||||
},
|
||||
}
|
||||
: name === '@/components/funding-classification'
|
||||
? load('components/funding-classification.tsx')
|
||||
: name === '@/components/funding-institution'
|
||||
? load('components/funding-institution.tsx')
|
||||
: name === '@/components/funding-dossier-choice'
|
||||
? { FundingDossierChoice: () => null }
|
||||
: name ===
|
||||
'@/components/funding-criteria-assessment'
|
||||
? load(
|
||||
'components/funding-criteria-assessment.tsx',
|
||||
)
|
||||
: require(name),
|
||||
module,
|
||||
module.exports,
|
||||
);
|
||||
@@ -146,8 +156,143 @@ test('actual public cards and detail lead with description/products and keep imp
|
||||
new RegExp(raw.title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),
|
||||
);
|
||||
}
|
||||
const out=new URL('../../outputs/funding-public-editorial-20261111/',import.meta.url);fs.mkdirSync(out,{recursive:true});const name=p.products.length?'bank-with-products':'investment-manager';fs.writeFileSync(new URL(name+'-index.html',out),index);fs.writeFileSync(new URL(name+'-detail.html',out),detail);fs.writeFileSync(new URL('verification.json',out),JSON.stringify({publishedSourceRecords:270,descriptionsPreserved:true,productsNotFabricated:true,actualPublicComponents:true,metadataRemovedFromPresentation:true,privateEditorialFieldsUnchanged:true,activeDataWrites:0,visualBrowserReview:false},null,2));
|
||||
const out = new URL(
|
||||
'../../outputs/funding-public-editorial-20261111/',
|
||||
import.meta.url,
|
||||
);
|
||||
fs.mkdirSync(out, { recursive: true });
|
||||
const name = p.products.length
|
||||
? 'bank-with-products'
|
||||
: 'investment-manager';
|
||||
fs.writeFileSync(new URL(name + '-index.html', out), index);
|
||||
fs.writeFileSync(new URL(name + '-detail.html', out), detail);
|
||||
fs.writeFileSync(
|
||||
new URL('verification.json', out),
|
||||
JSON.stringify(
|
||||
{
|
||||
publishedSourceRecords: 270,
|
||||
descriptionsPreserved: true,
|
||||
productsNotFabricated: true,
|
||||
actualPublicComponents: true,
|
||||
metadataRemovedFromPresentation: true,
|
||||
privateEditorialFieldsUnchanged: true,
|
||||
activeDataWrites: 0,
|
||||
visualBrowserReview: false,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
assert.match(detail, /Descrição/);
|
||||
if (p.products.length) assert.match(detail, /Soluções PME/);
|
||||
}
|
||||
});
|
||||
|
||||
test('Quorus and Moza use one shared clean profile in both list and detail', () => {
|
||||
const Index = load('pages/funding/index.tsx').default,
|
||||
Show = load('pages/funding/show.tsx').default;
|
||||
const out = new URL(
|
||||
'../../outputs/funding-uniform-menu-20261111/',
|
||||
import.meta.url,
|
||||
);
|
||||
fs.mkdirSync(out, { recursive: true });
|
||||
for (const title of ['Quorus', 'Moza Banco']) {
|
||||
const raw = records.find((p) => p.title === title);
|
||||
assert.ok(raw, title);
|
||||
const p = { ...raw, windows: [], documents: [] },
|
||||
item = {
|
||||
id: 'synthetic',
|
||||
version_id: 'synthetic-version',
|
||||
version: 1,
|
||||
payload: p,
|
||||
};
|
||||
const index = renderToStaticMarkup(
|
||||
React.createElement(Index, {
|
||||
items: { data: [item], links: [] },
|
||||
filters: {},
|
||||
kinds: {},
|
||||
options: { territories: [], sectors: [] },
|
||||
management: false,
|
||||
}),
|
||||
);
|
||||
const detail = renderToStaticMarkup(
|
||||
React.createElement(Show, {
|
||||
record: item,
|
||||
authenticated: false,
|
||||
saved: null,
|
||||
}),
|
||||
);
|
||||
for (const html of [
|
||||
index.match(/<article class="card">([\s\S]*?)<\/article>/)?.[0] ??
|
||||
index,
|
||||
detail,
|
||||
]) {
|
||||
assert.doesNotMatch(
|
||||
html,
|
||||
/Por confirmar|por confirmar|correspondência confirmada|Instituição identificada|Entidade responsável|Sectores:|Cobertura|garantia de financiamento|Não encontrado|ficha|Sede ou contacto indicado|Informação institucional/,
|
||||
);
|
||||
assert.equal((html.match(/Produtos e serviços/g) || []).length, 1);
|
||||
assert.equal((html.match(/Descrição/g) || []).length, 1);
|
||||
}
|
||||
if (title === 'Quorus') {
|
||||
assert.equal(
|
||||
(detail.match(/Entidade de corretagem de seguros/g) || [])
|
||||
.length,
|
||||
1,
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
detail,
|
||||
/<h3[^>]*>Contactos|<h3[^>]*>Localização/,
|
||||
);
|
||||
} else {
|
||||
assert.equal((detail.match(/21 342 000/g) || []).length, 1);
|
||||
assert.equal(
|
||||
(detail.match(/Rua dos Desportistas/g) || []).length,
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
(
|
||||
detail.match(
|
||||
/Tesouraria, investimento, construção e equipamento/g,
|
||||
) || []
|
||||
).length,
|
||||
1,
|
||||
);
|
||||
assert.doesNotMatch(detail, /500\.000|30\.000\.000|Prime|spread/);
|
||||
}
|
||||
fs.writeFileSync(
|
||||
new URL(title.replaceAll(' ', '-') + '-index.html', out),
|
||||
index,
|
||||
);
|
||||
fs.writeFileSync(
|
||||
new URL(title.replaceAll(' ', '-') + '-detail.html', out),
|
||||
detail,
|
||||
);
|
||||
}
|
||||
});
|
||||
test('contact and location deduplication preserves different branches and original records', () => {
|
||||
const moza = records.find((p) => p.title === 'Moza Banco'),
|
||||
original = JSON.stringify(moza);
|
||||
assert.equal(
|
||||
presentation
|
||||
.publicInstitutionContacts(moza.contacts)
|
||||
.filter((c) => c.kind === 'phone').length,
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
presentation.publicInstitutionLocations(moza.locations).length,
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
presentation.publicInstitutionLocations([
|
||||
...moza.locations,
|
||||
{
|
||||
...moza.locations[0],
|
||||
role: 'branch',
|
||||
address: 'Rua dos Desportistas, número 714',
|
||||
},
|
||||
]).length,
|
||||
2,
|
||||
);
|
||||
assert.equal(JSON.stringify(moza), original);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user