Added new test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
17a6a871ae
commit
41a6b34768
1 changed files with 18 additions and 1 deletions
|
@ -28,7 +28,7 @@ class LocationsViewTest extends TestCase
|
||||||
public function testViewingLocationAssetIndex()
|
public function testViewingLocationAssetIndex()
|
||||||
{
|
{
|
||||||
$location = Location::factory()->create();
|
$location = Location::factory()->create();
|
||||||
Asset::factory()->count(3)->assignedToLocation($location)->create();
|
Asset::factory()->count(3)->create(['location_id' => $location->id]);
|
||||||
|
|
||||||
$this->actingAsForApi(User::factory()->superuser()->create())
|
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||||
->getJson(route('api.locations.viewassets', $location->id))
|
->getJson(route('api.locations.viewassets', $location->id))
|
||||||
|
@ -41,4 +41,21 @@ class LocationsViewTest extends TestCase
|
||||||
'total' => 3,
|
'total' => 3,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testViewingAssignedLocationAssetIndex()
|
||||||
|
{
|
||||||
|
$location = Location::factory()->create();
|
||||||
|
Asset::factory()->count(3)->assignedToLocation($location)->create();
|
||||||
|
|
||||||
|
$this->actingAsForApi(User::factory()->superuser()->create())
|
||||||
|
->getJson(route('api.locations.assigned_assets', $location->id))
|
||||||
|
->assertOk()
|
||||||
|
->assertJsonStructure([
|
||||||
|
'total',
|
||||||
|
'rows',
|
||||||
|
])
|
||||||
|
->assertJson([
|
||||||
|
'total' => 3,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue