commit melhorias compras5
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-22 19:39:09 +02:00
parent 36dcfdf00c
commit db1615fac1
79 changed files with 4082 additions and 120 deletions
+4 -2
View File
@@ -133,7 +133,9 @@ test('equipment integration block separates native purchase requests from actual
test('equipment integration block preserves department and native requisition visibility with tenant isolation', function () {
$this->withoutVite();
$request = app(RequisitionWorkflow::class)->save($this->f['receiver'], equipmentRequestData($this->f));
// An existing equipment association belongs to a spare-part purchase, not a new capital asset.
$request = app(RequisitionWorkflow::class)->save($this->f['receiver'], equipmentRequestData($this->f, 'spare_part'));
expect($request->items()->sole()->purchase_type)->toBe('spare_part')->and($request->items()->sole()->equipment_id)->toBe($this->f['asset']->id);
$this->actingAs($this->f['finance'])->get('/equipamentos/'.$this->f['asset']->id)->assertOk()->assertInertia(fn (Assert $p) => $p->where('purchases.total', 1));
$otherDepartment = Department::query()->create(['tenant_id' => $this->f['tenant']->id, 'name' => 'Outra área']);
$request->update(['department_id' => $otherDepartment->id]);
@@ -150,7 +152,7 @@ test('equipment integration block keeps old purchase and movement pages independ
$this->withoutVite();
app(ReceiptWorkflow::class)->confirm($this->f['receiver'], $this->f['order'], receiptPayload($this->f));
foreach (range(1, 16) as $index) {
app(RequisitionWorkflow::class)->save($this->f['receiver'], equipmentRequestData($this->f));
app(RequisitionWorkflow::class)->save($this->f['receiver'], equipmentRequestData($this->f, 'spare_part'));
app(StockWorkflow::class)->record($this->f['receiver'], ['kind' => 'issue', 'reference' => 'EQ-PAGE-'.$index, 'idempotency_key' => (string) Str::uuid(),
'responsible_id' => $this->f['receiver']->id, 'warehouse_id' => $this->f['warehouse']->id, 'stock_item_id' => $this->f['stock']->id, 'equipment_id' => $this->f['asset']->id,
'quantity' => '0.001', 'reason' => 'Saída física nativa para paginação.']);