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
+11 -2
View File
@@ -127,8 +127,10 @@ class InvestmentPortfolioTest extends TestCase
$this->post('/investidor/guardar/'.$dossier->id)->assertRedirect();
$this->assertDatabaseCount('investor_journeys', 1);
$journey = InvestorJourney::firstOrFail();
$payload = ['message' => 'Pretendo investir neste projecto de teste.', 'country' => 'Moçambique', 'privacy_consent' => true, 'role' => 'investir', 'horizon' => '12 meses'];
$payload = ['message' => 'Pretendo investir neste projecto de teste.', 'country' => 'Moçambique', 'privacy_consent' => true, 'role' => 'investir', 'horizon' => '12 meses', 'declared_origin_country_code' => 'PT'];
$url = '/investidor/'.$journey->id.'/interesse';
$this->postJson($url, [...$payload, 'declared_origin_country_code' => 'ZZ'])->assertUnprocessable();
$this->assertDatabaseCount('interest_requests', 0);
$this->post($url, [...$payload, 'privacy_consent' => false])->assertSessionHasErrors('privacy_consent');
$this->actingAs($other)->post($url, $payload)->assertNotFound();
$this->get('/investidor')->assertInertia(fn (Assert $page) => $page->has('journeys', 0));
@@ -139,8 +141,10 @@ class InvestmentPortfolioTest extends TestCase
$this->assertDatabaseHas('investor_journeys', ['id' => $journey->id, 'status' => 'active']);
$metadata = json_decode(DB::table('interest_requests')->value('metadata'), true);
$this->assertSame($journey->id, $metadata['journey_id']);
$this->assertSame('PT', $metadata['declared_origin_country_code']);
$this->assertSame($dossier->project_id, $metadata['project_id']);
$this->get('/investidor')->assertInertia(fn (Assert $page) => $page->has('journeys', 1)->where('journeys.0.request_status', 'received'));
$this->get('/investidor')->assertInertia(fn (Assert $page) => $page->has('journeys', 1)->where('journeys.0.request_status', 'received')
->where('journeys.0.country', 'Moçambique')->where('journeys.0.declared_origin.code', 'PT'));
$conversion = ['owner_user_id' => $owner->id, 'title' => 'Interesse da jornada', 'next_action' => 'Contactar investidor', 'due_at' => now()->addDay()->toIso8601String()];
$interest = InterestRequest::firstOrFail();
try {
@@ -152,6 +156,11 @@ class InvestmentPortfolioTest extends TestCase
$lead = app(ConvertInterestToLead::class)->convert($interest, [...$conversion, 'investor_id' => $journey->investor_id], $owner->id);
$this->assertSame($journey->investor_id, $lead->investor_id);
$this->assertDatabaseCount('investors', 1);
config(['portal.managers' => [$owner->email]]);
$this->get('/management/interests?origin=PT')->assertInertia(fn (Assert $page) => $page
->where('requests.total', 1)->where('requests.data.0.declaredOrigin.code', 'PT')
->where('originStatistics.interests.0.code', 'PT')->where('originStatistics.interests.0.count', 1));
$this->get('/management/interests?origin=MZ')->assertInertia(fn (Assert $page) => $page->where('requests.total', 0)->has('originStatistics.interests', 0));
}
public function test_private_manifestation_link_requires_authentication_and_preserves_the_public_dossier(): void