fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -12,10 +12,13 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Mail\MailManager;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\Support\AuthenticatesQaActors;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PortalOperationsTest extends TestCase
|
||||
{
|
||||
use AuthenticatesQaActors;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_audit_records_actor_and_changes_without_free_text(): void
|
||||
@@ -33,6 +36,7 @@ class PortalOperationsTest extends TestCase
|
||||
$this->assertFalse(json_decode($updated->after_data, true)['values']['is_active']);
|
||||
$this->actingAs($user)->get('/management/history')->assertForbidden();
|
||||
config(['portal.managers' => [$user->email]]);
|
||||
$this->actingAsWithMfa($user);
|
||||
$this->get('/management/history')->assertOk();
|
||||
}
|
||||
|
||||
@@ -49,18 +53,19 @@ class PortalOperationsTest extends TestCase
|
||||
|
||||
public function test_public_notifications_are_disabled_by_default_and_enqueued_when_enabled(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
$payload = ['fullName' => 'Pessoa de teste', 'email' => 'portal-integration-test@gmail.com',
|
||||
'investorType' => 'empresa', 'country' => 'Moçambique', 'sectorInterest' => 'Energia',
|
||||
'message' => 'Pedido de teste na base isolada.', 'privacyConsent' => true];
|
||||
config(['portal.notifications_enabled' => false]);
|
||||
$this->postJson('/api/v1/interest-requests', $payload)->assertCreated();
|
||||
$this->postJson('/api/v1/interest-requests', $payload, ['Idempotency-Key' => (string) Str::uuid()])->assertCreated();
|
||||
$this->assertDatabaseCount('jobs', 0);
|
||||
config(['portal.notifications_enabled' => true, 'portal.notification_recipients' => ['team@example.invalid']]);
|
||||
$this->postJson('/api/v1/interest-requests', $payload)->assertCreated();
|
||||
$this->postJson('/api/v1/interest-requests', $payload, ['Idempotency-Key' => (string) Str::uuid()])->assertCreated();
|
||||
$this->assertDatabaseCount('jobs', 1);
|
||||
$this->assertDatabaseCount('interest_requests', 2);
|
||||
config(['queue.connections.database.after_commit' => true]);
|
||||
$this->postJson('/api/v1/interest-requests', $payload)->assertStatus(500);
|
||||
$this->postJson('/api/v1/interest-requests', $payload, ['Idempotency-Key' => (string) Str::uuid()])->assertStatus(500);
|
||||
$this->assertDatabaseCount('jobs', 1);
|
||||
$this->assertDatabaseCount('interest_requests', 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user