mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -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)
|
->assertResponseDoesNotContainInRows($consumableA)
|
||||||
->assertResponseContainsInRows($consumableB);
|
->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