Conferir e publicar instituições pelo editor assistido com MFA nativo
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-10 21:09:18 +02:00
parent 5a5cc9e815
commit ef24cbdc92
12 changed files with 612 additions and 97 deletions
@@ -16,6 +16,32 @@ final class FinancialInstitutionsSourceTest extends TestCase
{
use DatabaseTransactions;
public function test_assisted_editor_prepares_without_publishing_and_preserves_deliberate_edits(): void
{
$this->withoutVite();
$actor = User::factory()->create();
config(['portal.managers' => [$actor->email]]);
$this->actingAs($actor);
$this->get('/management/fundos/referencias-assistidas')->assertOk()->assertInertia(fn ($page) => $page->component('funding/assisted')->has('batch.items', 275));
$plan = $this->getJson('/management/fundos/referencias/arko')->assertOk()->json();
$receipt = $this->postJson('/management/fundos/referencias/arko/preparar', ['hash' => $plan['hash']])->assertOk()->assertJsonPath('created', true)->assertJsonPath('matches_reference', true)->json();
$id = $receipt['id'];
$this->assertNull(DB::table('funding_programmes')->where('id', $id)->value('published_version_id'));
$this->postJson('/management/fundos/referencias/arko/preparar', ['hash' => $plan['hash']])->assertOk()->assertJsonPath('created', false)->assertJsonPath('id', $id);
$body = [...$receipt['publication'], 'reason' => 'SYNTHETIC explicit editorial publication confirmation, rolled back.'];
$this->postJson('/management/fundos/'.$id.'/publicar', $body)->assertUnprocessable();
$published = $this->postJson('/management/fundos/'.$id.'/publicar', [...$body, 'confirm' => true])->assertOk()->json('version_id');
$this->postJson('/management/fundos/'.$id.'/publicar', [...$body, 'confirm' => true])->assertOk()->assertJsonPath('version_id', $published);
$row = DB::table('funding_programmes')->where('id', $id)->first();
$draft = json_decode($row->draft, true);
$draft['summary'] .= ' Deliberate QA editorial clarification.';
DB::table('funding_programmes')->where('id', $id)->update(['draft' => json_encode($draft), 'version' => $row->version + 1]);
$this->postJson('/management/fundos/referencias/arko/preparar', ['hash' => $plan['hash']])->assertOk()->assertJsonPath('matches_reference', false)->assertJsonPath('publication', null);
$this->assertSame($draft, json_decode(DB::table('funding_programmes')->where('id', $id)->value('draft'), true));
$other = User::factory()->create();
$this->actingAs($other)->get('/management/fundos/referencias-assistidas')->assertForbidden();
}
public function test_city_or_branch_text_is_searchable_without_treating_wildcards_as_search_commands(): void
{
$this->withoutVite();