feat: add workforce evidence and sourced economic context map layers

This commit is contained in:
2026-11-04 11:27:37 +02:00
parent 21ebad73e7
commit a9241ff26b
11 changed files with 358 additions and 16 deletions
@@ -137,7 +137,7 @@ test('default preserves every opportunity and one map, with sourced thematic evi
'Partial coverage',
'2026-10-01',
'não representam a posição exacta',
'não são inferidos',
'sem índice',
])
assert.ok(html.includes(text), text);
assert.match(html, /2 fichas com evidência temática pública/);
@@ -216,7 +216,7 @@ test('changing query data never retains previous evidence; loading and incomplet
);
assert.match(html, /Sem evidência pública local/);
assert.match(html, /A resposta está limitada/);
assert.match(html, /não significa ausência do recurso/);
assert.match(html, /não significa ausência de recursos/);
});
test('theme selection survives reload in the tab and unavailable or invalid storage does not break the map', () => {
@@ -276,3 +276,63 @@ test('theme selection survives reload in the tab and unavailable or invalid stor
else globalThis.window = previous;
}
});
test('workforce and economic context preserve source categories and incompatible periods without inferred totals or borrowed points', () => {
const Component = setup();
const extra = [
{
...records[0],
id: 4,
title: 'Workforce evidence',
evidence: [{ ...proof('workforce'), source_category: 'workforce' }],
},
{
...records[1],
id: 5,
title: 'Economic context',
evidence: [
{
...proof('economic_potential'),
id: 'supply',
source_category: 'supply',
period: '2023',
},
{
...proof('economic_potential'),
id: 'demand',
source_category: 'demand',
period: '2026',
},
],
},
];
const data = { ...props, records: [...records, ...extra] };
flat(Component(data))
.find((node) => node.type === 'select')
.props.onChange({ target: { value: 'workforce' } });
let tree = Component(data);
assert.deepEqual(
flat(tree).find((node) => node.type === Map).props.points,
[],
);
let html = renderToStaticMarkup(tree);
assert.match(html, /Workforce evidence/);
assert.match(html, /Categoria de origem: Mão-de-obra/);
assert.match(html, /não mede trabalhadores disponíveis/);
flat(tree)
.find((node) => node.type === 'select')
.props.onChange({ target: { value: 'economic_potential' } });
tree = Component(data);
html = renderToStaticMarkup(tree);
assert.match(html, /Economic context/);
assert.match(html, /Categoria de origem: Oferta/);
assert.match(html, /Categoria de origem: Procura/);
assert.match(html, /2023/);
assert.match(html, /2026/);
assert.match(html, /sem índice, previsão de retorno ou viabilidade/);
assert.doesNotMatch(html, /Workforce evidence/);
assert.deepEqual(
flat(tree).find((node) => node.type === Map).props.points,
[],
);
});