Skip to content

A free open source IT asset/license management system

Added new test

snipe41a6b347681e
diff --git a/tests/Feature/Locations/Api/LocationsViewTest.php b/tests/Feature/Locations/Api/LocationsViewTest.php
index 9f564a6f03..cec020d1ca 100644
--- a/tests/Feature/Locations/Api/LocationsViewTest.php
+++ b/tests/Feature/Locations/Api/LocationsViewTest.php
@@ -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,
+ ]);
+ }
}