This commit is contained in:
@@ -67,8 +67,53 @@ class BusinessMarketplacePublicTest extends TestCase
|
||||
$this->assertDatabaseCount('interest_requests', 1);
|
||||
}
|
||||
|
||||
public function test_public_catalogue_filters_by_existing_opportunity_modality_and_opens_response_flow(): void
|
||||
{
|
||||
$business = $this->publishedBusiness('real_estate');
|
||||
$companySale = $this->publishedBusiness('company_sale');
|
||||
$landRight = $this->publishedBusiness('land_right');
|
||||
|
||||
$this->getJson('/api/v1/business-opportunities?modality=real_estate')->assertOk()
|
||||
->assertJsonCount(1, 'data')->assertJsonPath('data.0.modality', 'real_estate');
|
||||
$this->getJson('/api/v1/business-opportunities?modality=company_sale')->assertOk()
|
||||
->assertJsonCount(1, 'data')->assertJsonPath('data.0.modality', 'company_sale');
|
||||
$this->getJson('/api/v1/business-opportunities?modality=land_right')->assertOk()
|
||||
->assertJsonCount(1, 'data')->assertJsonPath('data.0.modality', 'land_right');
|
||||
|
||||
$this->get('/negocios?modality=real_estate')->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-marketplace')
|
||||
->where('filters.modality', 'real_estate')->has('results.data', 1));
|
||||
$this->get('/negocios/'.$business['public_slug'])->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-opportunity')
|
||||
->where('record.modality', 'real_estate'));
|
||||
$this->get('/negocios/'.$business['public_slug'].'/manifestar-interesse')->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-interest')
|
||||
->where('record.modality', 'real_estate'));
|
||||
$this->get('/negocios?modality=company_sale')->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-marketplace')
|
||||
->where('filters.modality', 'company_sale')->has('results.data', 1));
|
||||
$this->get('/negocios/'.$companySale['public_slug'])->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-opportunity')
|
||||
->where('record.modality', 'company_sale'));
|
||||
$this->get('/negocios?modality=land_right')->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-marketplace')
|
||||
->where('filters.modality', 'land_right')->has('results.data', 1));
|
||||
$this->get('/negocios/'.$landRight['public_slug'])->assertOk()
|
||||
->assertInertia(fn ($page) => $page->component('investment/business-opportunity')
|
||||
->where('record.modality', 'land_right'));
|
||||
|
||||
$this->postJson('/api/v1/interest-requests', [
|
||||
'existingBusinessId' => $business['id'], 'modality' => 'real_estate',
|
||||
'fullName' => 'Synthetic investor', 'email' => 'portal-integration-test@gmail.com', 'phone' => '+258 840000000',
|
||||
'investorType' => 'empresa', 'country' => 'MZ', 'sectorInterest' => 'Imobiliário',
|
||||
'message' => 'Synthetic interest in the published real estate opportunity.',
|
||||
'privacyConsent' => true,
|
||||
])->assertCreated();
|
||||
$this->assertDatabaseHas('interest_requests', ['existing_business_id' => $business['id'], 'modality' => 'real_estate', 'status' => 'received']);
|
||||
}
|
||||
|
||||
/** @return array{id:string,public_slug:string} */
|
||||
private function publishedBusiness(): array
|
||||
private function publishedBusiness(string $modality = 'company_sale'): array
|
||||
{
|
||||
$id = (string) Str::uuid();
|
||||
$slug = 'public-synthetic-'.$id;
|
||||
@@ -77,7 +122,7 @@ class BusinessMarketplacePublicTest extends TestCase
|
||||
'id' => $id,
|
||||
'code' => 'SYN-'.strtoupper(substr(str_replace('-', '', $id), 0, 12)),
|
||||
'owner_user_id' => User::factory()->create()->id,
|
||||
'modality' => 'company_sale',
|
||||
'modality' => $modality,
|
||||
'status' => 'published',
|
||||
'classification' => 'confidential',
|
||||
'version_no' => 1,
|
||||
|
||||
Reference in New Issue
Block a user