feat(inventory): add traceable cart stock reservations
This commit is contained in:
@@ -73,6 +73,11 @@ class CartControllerTest extends TestCase
|
||||
'id' => $item->inventory_id,
|
||||
'reserved_stock' => 2,
|
||||
]);
|
||||
$this->assertDatabaseHas('stock_reservations', [
|
||||
'inventory_id' => $item->inventory_id,
|
||||
'quantity' => 2,
|
||||
'status' => 'active',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_it_filters_item_images_when_the_tenant_disables_them(): void
|
||||
@@ -129,6 +134,12 @@ class CartControllerTest extends TestCase
|
||||
'id' => $variant->inventory_id,
|
||||
'reserved_stock' => 5,
|
||||
]);
|
||||
$this->assertDatabaseHas('stock_reservations', [
|
||||
'cart_item_id' => $response->json('data.items.0.id'),
|
||||
'inventory_id' => $variant->inventory_id,
|
||||
'quantity' => 5,
|
||||
'status' => 'active',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_authenticated_cart_respects_previous_purchases_and_repeated_additions(): void
|
||||
@@ -283,6 +294,12 @@ class CartControllerTest extends TestCase
|
||||
'id' => $variant->inventory_id,
|
||||
'reserved_stock' => 0,
|
||||
]);
|
||||
$this->assertDatabaseHas('stock_reservations', [
|
||||
'cart_item_id' => null,
|
||||
'inventory_id' => $variant->inventory_id,
|
||||
'quantity' => 0,
|
||||
'status' => 'released',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_it_changes_an_item_variant_and_moves_the_stock_reservation(): void
|
||||
|
||||
Reference in New Issue
Block a user