feat(purchase): implement purchase limit enforcement and custom exception handling
This commit is contained in:
@@ -241,7 +241,15 @@ class CartControllerTest extends TestCase
|
||||
'cantidad' => 2,
|
||||
])
|
||||
->assertUnprocessable()
|
||||
->assertJsonValidationErrors('cantidad');
|
||||
->assertJsonValidationErrors('cantidad')
|
||||
->assertJsonPath('code', 'purchase.limit_exceeded')
|
||||
->assertJsonPath('catalog_item_id', $item->id)
|
||||
->assertJsonPath('catalog_item_name', $item->nombre)
|
||||
->assertJsonPath('maximum_addable_quantity', 1)
|
||||
->assertJsonPath(
|
||||
'message',
|
||||
"Podés agregar hasta 1 unidad más de “{$item->nombre}”.",
|
||||
);
|
||||
|
||||
$this->assertDatabaseHas('carrito_items', [
|
||||
'catalog_item_id' => $item->id,
|
||||
|
||||
Reference in New Issue
Block a user