test(stock): cover authoritative reservation expiration
This commit is contained in:
@@ -538,7 +538,6 @@ class StorePurchaseTest extends TestCase
|
||||
$previousPurchase->update([
|
||||
'status' => Purchase::STATUS_PENDING_PAYMENT,
|
||||
'payment_method' => 'transfer',
|
||||
'expires_at' => now()->addMinutes(30),
|
||||
]);
|
||||
|
||||
$currentPurchase = app(CheckoutService::class)->startCheckout(
|
||||
@@ -550,7 +549,6 @@ class StorePurchaseTest extends TestCase
|
||||
$this->assertDatabaseHas('compras', [
|
||||
'id' => $previousPurchase->id,
|
||||
'status' => Purchase::STATUS_SUPERSEDED,
|
||||
'expires_at' => null,
|
||||
]);
|
||||
$this->assertDatabaseHas('carritos', [
|
||||
'id' => $cart->id,
|
||||
@@ -635,7 +633,7 @@ class StorePurchaseTest extends TestCase
|
||||
->where('status', 'active')
|
||||
->firstOrFail();
|
||||
$cartItemId = $purchase->cart->items()->firstOrFail()->id;
|
||||
$purchase->update(['expires_at' => now()->subMinute()]);
|
||||
$purchase->stockReservation()->update(['expires_at' => now()->subMinute()]);
|
||||
|
||||
$this->artisan('reservations:expire')->assertSuccessful();
|
||||
|
||||
@@ -860,7 +858,6 @@ class StorePurchaseTest extends TestCase
|
||||
$purchase->update([
|
||||
'payment_method' => 'transfer',
|
||||
'status' => Purchase::STATUS_PENDING_PAYMENT,
|
||||
'expires_at' => now()->addMinutes(30),
|
||||
]);
|
||||
|
||||
$url = "/api/tenants/sonder/compras/{$purchase->id}/review";
|
||||
@@ -874,6 +871,10 @@ class StorePurchaseTest extends TestCase
|
||||
$this->assertDatabaseHas('compras', [
|
||||
'id' => $purchase->id,
|
||||
'status' => Purchase::STATUS_IN_REVIEW,
|
||||
]);
|
||||
$this->assertDatabaseHas('stock_reservations', [
|
||||
'id' => $purchase->stock_reservation_id,
|
||||
'status' => 'active',
|
||||
'expires_at' => null,
|
||||
]);
|
||||
|
||||
@@ -956,7 +957,7 @@ class StorePurchaseTest extends TestCase
|
||||
->where('status', 'active')
|
||||
->firstOrFail();
|
||||
|
||||
$this->assertNotNull($purchase->expires_at);
|
||||
$this->assertNotNull($purchase->stockReservation->expires_at);
|
||||
$this->assertDatabaseHas('inventories', [
|
||||
'id' => $variant->inventory_id,
|
||||
'reserved_stock' => 3,
|
||||
|
||||
Reference in New Issue
Block a user