fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -12,10 +12,12 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Str;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\Support\AuthenticatesQaActors;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PortalAuditContinuationTest extends TestCase
|
||||
{
|
||||
use AuthenticatesQaActors;
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
@@ -38,6 +40,7 @@ class PortalAuditContinuationTest extends TestCase
|
||||
|
||||
public function test_public_country_and_origin_survive_api_storage_management_recovery_and_statistics(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
foreach (['/', '/manifestar-interesse', '/apoio', '/formularios/investidor', '/formularios/empresa'] as $url) {
|
||||
$this->get($url)->assertInertia(fn (Assert $page) => $page->has('countries', 249));
|
||||
}
|
||||
@@ -52,7 +55,7 @@ class PortalAuditContinuationTest extends TestCase
|
||||
$this->assertSame('ZA', $interest->metadata['declared_origin_country_code']);
|
||||
$manager = User::factory()->create();
|
||||
config(['portal.managers' => [$manager->email]]);
|
||||
$this->actingAs($manager)->get('/management/interests/'.$interest->id)->assertInertia(fn (Assert $page) => $page
|
||||
$this->actingAsWithMfa($manager)->get('/management/interests/'.$interest->id)->assertInertia(fn (Assert $page) => $page
|
||||
->component('management/interest')->where('interest.country', 'PT')->where('declaredOrigin.code', 'ZA')->where('declaredOrigin.name', app(CountryCatalogue::class)->describe('ZA')['name']));
|
||||
$this->get('/management/crm/leads?origin=ZA')->assertInertia(fn (Assert $page) => $page
|
||||
->where('originStatistics.interests.0.code', 'ZA')->where('originStatistics.interests.0.count', 1));
|
||||
@@ -73,7 +76,7 @@ class PortalAuditContinuationTest extends TestCase
|
||||
$this->assertSame('PT', InterestRequest::latest('id')->firstOrFail()->country);
|
||||
$this->assertSame('ZA', InterestRequest::latest('id')->firstOrFail()->metadata['declared_origin_country_code']);
|
||||
$interest = InterestRequest::latest('id')->firstOrFail();
|
||||
$this->actingAs($manager)->get('/management/interests/'.$interest->id)->assertInertia(fn (Assert $p) => $p
|
||||
$this->actingAsWithMfa($manager)->get('/management/interests/'.$interest->id)->assertInertia(fn (Assert $p) => $p
|
||||
->where('interest.country', 'PT')->where('declaredOrigin.code', 'ZA'));
|
||||
$this->get('/management/interests?country=PT&origin=ZA')->assertInertia(fn (Assert $p) => $p
|
||||
->where('requests.total', $index + 1)->where('originStatistics.interests.0.code', 'ZA')
|
||||
@@ -153,7 +156,7 @@ class PortalAuditContinuationTest extends TestCase
|
||||
$this->getJson('/api/v1/investment/territory-options?'.http_build_query(['type' => $type, 'parent_id' => $parent, 'q' => 'sintetico']))
|
||||
->assertOk()->assertJsonPath('data.0.id', $selected);
|
||||
}
|
||||
$service = $this->actingAs($manager)->postJson('/management/balcao/servicos', ['code' => 'project-preparation', 'confirm' => true])->assertCreated()->json('id');
|
||||
$service = $this->actingAsWithMfa($manager)->postJson('/management/balcao/servicos', ['code' => 'project-preparation', 'confirm' => true])->assertCreated()->json('id');
|
||||
$case = $this->actingAs($owner)->postJson('/balcao-virtual/dossiers', ['title' => 'Dossier sintético QA', 'client_key' => (string) Str::uuid(), 'reuse_consent' => true])->assertCreated()->json('id');
|
||||
$id = $this->postJson('/balcao-virtual/dossiers/'.$case.'/pedidos', ['service_version_id' => $service, 'client_key' => (string) Str::uuid()])->assertCreated()->json('id');
|
||||
$url = '/balcao-virtual/pedidos/'.$id;
|
||||
@@ -171,7 +174,7 @@ class PortalAuditContinuationTest extends TestCase
|
||||
$this->actingAs($owner)->getJson($url)->assertJsonPath('territoryPaths.territory_id.3.id', $locality);
|
||||
$submitted = [...$payload, 'description' => 'Descrição exclusivamente sintética na QA.', 'investment_amount' => '10.00', 'currency' => 'MZN'];
|
||||
$this->putJson($url, ['version' => 2, 'payload' => $submitted, 'consent' => true, 'submit' => true])->assertOk()->assertJsonPath('status', 'submitted');
|
||||
$this->actingAs($manager)->get('/management/crm/leads?origin=PT')->assertInertia(fn (Assert $page) => $page
|
||||
$this->actingAsWithMfa($manager)->get('/management/crm/leads?origin=PT')->assertInertia(fn (Assert $page) => $page
|
||||
->has('originStatistics.interests', 0)->where('originStatistics.desk.0.code', 'PT')->where('originStatistics.desk.0.count', 1));
|
||||
Http::assertNothingSent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user