Added new test

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-12-12 20:08:37 +00:00 committed by Brady Wetherington
parent 17a6a871ae
commit 41a6b34768

View file

@ -28,7 +28,7 @@ class LocationsViewTest extends TestCase
public function testViewingLocationAssetIndex()
{
$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())
->getJson(route('api.locations.viewassets', $location->id))
@ -41,4 +41,21 @@ class LocationsViewTest extends TestCase
'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,
]);
}
}