Corrige autorizacao transaccional e valida modulos implementados

This commit is contained in:
2026-10-28 17:19:33 +02:00
parent 95dd2cc1ed
commit 5ff8d78803
30 changed files with 601 additions and 97 deletions
+11
View File
@@ -149,3 +149,14 @@ test('budget service refuses a requisition belonging to another company', functi
}
expect(BudgetEntry::query()->count())->toBe(0);
});
test('unapproved allocation displays no authorised or available funds', function () {
$this->get('/orcamentos')->assertOk()->assertInertia(fn ($page) => $page->where('budgets.0.amount_minor', 20000)->where('budgets.0.approved_total_minor', 0)->where('budgets.0.available_minor', 0));
});
test('initial allocation approval rechecks administrator role inside transaction', function () {
$this->actingAs($this->approver);
DB::table('users')->where('id', $this->approver->id)->update(['purchasing_role' => 'warehouse']);
$this->post('/orcamentos/'.$this->budget->id.'/aprovar')->assertForbidden();
expect($this->budget->refresh()->approved_by)->toBeNull();
});