oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
+12
View File
@@ -198,9 +198,21 @@ class InvestorGuidanceTest extends TestCase
$this->assertArrayNotHasKey('market_evidence', $owner['facts']);
$this->assertStringNotContainsString('PRIVATE PERSONAL', json_encode($owner));
$this->assertSame(1, $owner['consulted'][0]['version']);
$draftUrl = '/simulador-fiscal?draft='.$draft->id;
$this->assertSame($draftUrl, $owner['actions']['simulator']);
$this->assertSame($draftUrl, $owner['actions']['plan']);
$finance = collect($owner['phases'])->firstWhere('id', 'finance');
$this->assertSame($draftUrl, $finance['recommendations'][0]['href']);
$otherDraft = $draft->replicate();
$otherDraft->id = (string) Str::uuid();
$otherDraft->economic_snapshot = SimulationFormDraft::encryptSnapshot(['project_summary' => 'Outro projecto, não reutilizar']);
$otherDraft->save();
$this->getJson('/api/v1/simulation-drafts/'.$draft->id)->assertOk()->assertJsonPath('data.id', $draft->id)->assertJsonPath('data.economic_snapshot.project_summary', 'Ideia guardada');
$manager = $this->actingAs($this->manager)->getJson('/balcao-virtual/dossiers/'.$id.'/orientacao')->assertOk()->json();
$this->assertNull($manager['financial_draft']);
$this->assertSame([], $manager['consulted']);
$this->assertSame('/simulador-fiscal', $manager['actions']['simulator']);
$this->getJson('/api/v1/simulation-drafts/'.$draft->id)->assertNotFound();
$this->actingAs($this->investor)->postJson('/balcao-virtual/dossiers', ['title' => 'Reutilização', 'simulation_id' => $draft->id, 'client_key' => (string) Str::uuid(), 'reuse_consent' => true])->assertJsonPath('id', $id);
$this->assertDatabaseCount('desk_cases', 1);
$this->actingAs(User::factory()->create())->getJson('/balcao-virtual/dossiers/'.$id.'/orientacao')->assertForbidden();