mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Added test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
a7a1a377da
commit
2b5463475c
|
@ -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,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue