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
+20
View File
@@ -62,6 +62,26 @@ final class ProactiveInvestmentTest extends TestCase
return $input;
}
public function test_workforce_evidence_saves_recovers_and_requires_existing_explicit_publication(): void
{
$input = F::input();
$input['proactive']['evidence'][0]['category'] = 'workforce';
$id = $this->postJson('/minhas-oportunidades/drafts', $input)->assertCreated()->json('id');
$o = Opportunity::findOrFail($id);
$analysis = app(OpportunityManagement::class)->values($o)['proactive'];
$this->assertSame('workforce', $analysis['evidence'][0]['category']);
$this->assertNull(app(ProactiveInvestment::class)->publicData($o));
$this->publish($o);
$this->getJson('/api/v1/investment/map?opportunity_id='.$id)->assertOk()
->assertJsonPath('thematic_records.0.evidence.0.category', 'workforce')
->assertJsonPath('thematic_records.0.evidence.0.source', $analysis['evidence'][0]['source'])
->assertJsonCount(1, 'thematic_records.0.evidence')->assertJsonCount(0, 'features');
$analysis['evidence'][0]['category'] = 'demand';
$this->putJson('/minhas-oportunidades/'.$id.'/draft', ['etag' => app(OpportunityManagement::class)->etag($o->fresh()), 'proactive' => $analysis,
'reason' => 'SYNTHETIC QA later private changes must not replace the published workforce source'])->assertOk();
$this->getJson('/api/v1/investment/map?opportunity_id='.$id)->assertOk()->assertJsonPath('thematic_records.0.evidence.0.category', 'workforce');
}
public function test_legacy_records_without_analysis_add_no_publication_lookup(): void
{
$o = new Opportunity;