commit melhorias compras4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-22 16:28:03 +02:00
parent efd97e265b
commit 36dcfdf00c
118 changed files with 6042 additions and 92 deletions
@@ -112,6 +112,17 @@ test('autonomous adapter executes shared lifecycle with one request one reserve
$this->get('/requisicoes/'.$r->id)->assertOk();
});
test('one eligible approver completes the level even when another approver is eligible for the same level', function () {
$alternative = User::factory()->create(['tenant_id' => $this->actor->tenant_id, 'department_id' => $this->actor->department_id, 'purchasing_role' => PurchasingRole::DepartmentHead]);
$this->postJson('/requisicoes', $this->data)->assertRedirect();
$r = Requisition::query()->latest('id')->firstOrFail();
$this->postJson('/requisicoes/'.$r->id.'/submeter', ['operation_key' => (string) Str::uuid(), 'process_version' => 1])->assertRedirect();
expect($r->fresh()->canDecide($this->head))->toBeTrue()->and($r->fresh()->canDecide($alternative))->toBeTrue();
$this->actingAs($alternative)->postJson('/requisicoes/'.$r->id.'/decidir', ['operation_key' => (string) Str::uuid(), 'process_version' => 2, 'decision' => 'approved'])->assertRedirect();
expect($r->fresh()->status)->toBe('approved')->and($r->steps()->sole()->approver_id)->toBe($alternative->id)
->and($r->fresh()->canDecide($this->head))->toBeFalse()->and($r->steps()->count())->toBe(1);
});
test('source adapter refuses changed replay stale version revoked role and another tenant', function () {
$this->postJson('/requisicoes', $this->data)->assertRedirect();
$r = Requisition::query()->latest('id')->firstOrFail();