commit14
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Tempo\Finance\Payables\Payables;
|
||||
|
||||
@@ -107,3 +108,16 @@ test('a full confirmation leaves zero balance and prevents another confirmation'
|
||||
expect(app(SupplierPayables::class)->balance($this->f['invoice']))->toBe(0);
|
||||
expect(fn () => $workflow->review($this->f['validator'], $this->payment, 'confirmed', 'Saldo já liquidado'))->toThrow(ValidationException::class);
|
||||
});
|
||||
|
||||
test('task inbox delegates imported payment authority without exposing or deciding the ledger', function () {
|
||||
$before = [DB::table('pa_payment_decisions')->count(), DB::table('audit_logs')->count(), $this->frozen];
|
||||
$this->get('/requisicoes/tarefas?module=finance')->assertInertia(fn (Assert $page) => $page->where('tasks.total', 2));
|
||||
config(['common-payables.history_decisions_enabled' => false]);
|
||||
$this->get('/requisicoes/tarefas?module=finance')->assertOk()->assertInertia(fn (Assert $page) => $page->where('tasks.total', 0));
|
||||
config(['common-payables.history_decisions_enabled' => true]);
|
||||
DB::table('pa_access')->where('user_id', $this->f['validator']->id)->where('action', 'validate')->delete();
|
||||
$this->get('/requisicoes/tarefas?module=finance')->assertInertia(fn (Assert $page) => $page->where('tasks.total', 0));
|
||||
config(['common-payables.source_instance' => 'different-installation']);
|
||||
$this->get('/requisicoes/tarefas?module=finance')->assertOk()->assertInertia(fn (Assert $page) => $page->where('tasks.total', 0));
|
||||
expect([DB::table('pa_payment_decisions')->count(), DB::table('audit_logs')->count(), Payables::canonical(['imports' => DB::table('pa_history_imports')->get()->toArray(), 'payments' => DB::table('pa_imported_payments')->get()->toArray()])])->toEqual($before);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user