fix: complete InvesteMoz validation and error corrections

This commit is contained in:
2026-10-29 21:47:33 +02:00
parent 63147312e2
commit daf8623441
718 changed files with 127308 additions and 20959 deletions
+5 -2
View File
@@ -12,10 +12,12 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\ValidationException;
use Inertia\Testing\AssertableInertia as Assert;
use Tests\Support\AuthenticatesQaActors;
use Tests\TestCase;
class InvestmentPortfolioTest extends TestCase
{
use AuthenticatesQaActors;
use RefreshDatabase;
public function test_document_import_is_idempotent_preserves_edits_and_links_all_anchors(): void
@@ -44,7 +46,7 @@ class InvestmentPortfolioTest extends TestCase
$dossier = InvestmentDossier::firstOrFail();
$url = '/management/portfolio/'.$dossier->id;
$payload = ['version_no' => $dossier->version_no, 'title' => 'Revisao mais recente', 'source' => $dossier->source, 'content' => $dossier->content];
$this->actingAs($manager)->put($url, $payload)->assertRedirect()->assertSessionHasNoErrors();
$this->actingAsWithMfa($manager)->put($url, $payload)->assertRedirect()->assertSessionHasNoErrors();
$this->putJson($url, [...$payload, 'title' => 'Alteracao obsoleta'])->assertStatus(409);
$approval = ['version_no' => $dossier->version_no, 'approval_evidence' => 'Aprovacao sintetica da versao revista'];
$this->postJson($url.'/publish', $approval)->assertStatus(409);
@@ -101,7 +103,7 @@ class InvestmentPortfolioTest extends TestCase
$dossier = InvestmentDossier::firstOrFail();
$manager = User::factory()->create();
config(['portal.managers' => [$manager->email]]);
$this->actingAs($manager)->post('/management/portfolio/'.$dossier->id.'/publish', [
$this->actingAsWithMfa($manager)->post('/management/portfolio/'.$dossier->id.'/publish', [
'version_no' => $dossier->version_no, 'approval_evidence' => 'Synthetic owner approval is not an editor assignment',
])->assertStatus(422);
$this->get('/carteira/'.$dossier->id)->assertNotFound();
@@ -157,6 +159,7 @@ class InvestmentPortfolioTest extends TestCase
$this->assertSame($journey->investor_id, $lead->investor_id);
$this->assertDatabaseCount('investors', 1);
config(['portal.managers' => [$owner->email]]);
$this->actingAsWithMfa($owner);
$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));