Files
compras/tests/Feature/PurchaseDocumentCompatibilityTest.php
T
nala 36dcfdf00c
tests / ci (push) Canceled after 0s
commit melhorias compras4
2026-11-22 16:28:03 +02:00

18 lines
1.0 KiB
PHP

<?php
use Inertia\Testing\AssertableInertia as Assert;
require_once __DIR__.'/../Support/ReceiptFixture.php';
test('older synthetic order remains readable and printable without rewriting its incomplete snapshot', function () {
$f = receiptFixture();
$order = $f['order'];
$before = $order->fresh()->toArray();
$this->actingAs($f['issuer']);
$this->get('/ordens')->assertOk()->assertInertia(fn (Assert $page) => $page->where('orders.data.0.id', $order->id));
$this->get('/ordens/'.$order->id)->assertOk()->assertInertia(fn (Assert $page) => $page->where('snapshotComplete', false)->where('order.snapshot', $order->snapshot));
$this->get('/ordens/'.$order->id.'/imprimir')->assertOk()->assertSee('Documento original incompleto.')->assertSee($order->number)->assertSee('100,00 MZN')->assertDontSee('Matriz de avaliação congelada');
expect($order->fresh()->toArray())->toBe($before);
$this->actingAs(receiptFixture()['issuer'])->get('/ordens/'.$order->id.'/imprimir')->assertNotFound();
});