A free open source IT asset/license management system
Added test
snipe2b5463475c95
diff --git a/tests/Feature/Consumables/Api/ConsumableIndexTest.php b/tests/Feature/Consumables/Api/ConsumableIndexTest.phpindex b16dfdfa53..f1d3ad7f0b 100644--- a/tests/Feature/Consumables/Api/ConsumableIndexTest.php+++ b/tests/Feature/Consumables/Api/ConsumableIndexTest.php@@ -54,4 +54,29 @@ class ConsumableIndexTest extends TestCase->assertResponseDoesNotContainInRows($consumableA)->assertResponseContainsInRows($consumableB);}++ public function testConsumableIndexReturnsExpectedSearchResults()+ {+ Consumable::factory()->count(10)->create();+ Consumable::factory()->count(1)->create(['name' => 'My Test Consumable']);++ $this->actingAsForApi(User::factory()->superuser()->create())+ ->getJson(+ route('api.consumables.index', [+ 'search' => 'My Test Consumable',+ 'sort' => 'name',+ 'order' => 'asc',+ 'offset' => '0',+ 'limit' => '20',+ ]))+ ->assertOk()+ ->assertJsonStructure([+ 'total',+ 'rows',+ ])+ ->assertJson([+ 'total' => 1,+ ]);++ }}