@@ -73,7 +73,7 @@ public function testDeviceShowIncludesLocation(): void
7373 $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=location " );
7474
7575 $ response ->assertStatus (200 )
76- ->assertJsonPath ('data.relationships.location.attributes.location ' , $ location ->location );
76+ ->assertJsonPath ('data.relationships.location.attributes.name ' , $ location ->location );
7777 }
7878
7979 public function testDeviceShowIncludesGroups (): void
@@ -84,10 +84,10 @@ public function testDeviceShowIncludesGroups(): void
8484 $ device ->groups ()->attach ($ groups ->pluck ('id ' ));
8585 Sanctum::actingAs ($ user );
8686
87- $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=groups " );
87+ $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=device- groups " );
8888
8989 $ response ->assertStatus (200 )
90- ->assertJsonCount (2 , 'data.relationships.groups ' );
90+ ->assertJsonCount (2 , 'data.relationships.device- groups ' );
9191 }
9292
9393 public function testDeviceIndexIncludesRelationships (): void
@@ -102,7 +102,7 @@ public function testDeviceIndexIncludesRelationships(): void
102102
103103 $ response ->assertStatus (200 )
104104 ->assertJsonCount (2 , 'data.0.relationships.ports ' )
105- ->assertJsonPath ('data.0.relationships.location.attributes.location ' , $ location ->location );
105+ ->assertJsonPath ('data.0.relationships.location.attributes.name ' , $ location ->location );
106106 }
107107
108108 public function testDeviceWithoutRelatedParamExcludesRelationships (): void
@@ -234,10 +234,10 @@ public function testAlertRuleIncludesGroups(): void
234234 $ rule ->groups ()->attach ($ groups ->pluck ('id ' ));
235235 Sanctum::actingAs ($ user );
236236
237- $ response = $ this ->getJson ("/api/v1/alert-rules/ {$ rule ->id }?related=groups " );
237+ $ response = $ this ->getJson ("/api/v1/alert-rules/ {$ rule ->id }?related=device- groups " );
238238
239239 $ response ->assertStatus (200 )
240- ->assertJsonCount (2 , 'data.relationships.groups ' );
240+ ->assertJsonCount (2 , 'data.relationships.device- groups ' );
241241 }
242242
243243 public function testAlertRuleIncludesLocations (): void
@@ -639,12 +639,12 @@ public function testMultipleRelationshipsCanBeRequested(): void
639639 Port::factory ()->count (2 )->for ($ device )->create ();
640640 Sanctum::actingAs ($ user );
641641
642- $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=ports,location,groups " );
642+ $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=ports,location,device- groups " );
643643
644644 $ response ->assertStatus (200 )
645645 ->assertJsonCount (2 , 'data.relationships.ports ' )
646- ->assertJsonPath ('data.relationships.location.attributes.location ' , $ location ->location )
647- ->assertJsonCount (1 , 'data.relationships.groups ' );
646+ ->assertJsonPath ('data.relationships.location.attributes.name ' , $ location ->location )
647+ ->assertJsonCount (1 , 'data.relationships.device- groups ' );
648648 }
649649
650650 // ── Empty relationships ─────────────────────────────────
@@ -667,10 +667,10 @@ public function testEmptyBelongsToManyReturnsEmptyArray(): void
667667 $ device = Device::factory ()->create ();
668668 Sanctum::actingAs ($ user );
669669
670- $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=groups " );
670+ $ response = $ this ->getJson ("/api/v1/devices/ {$ device ->device_id }?related=device- groups " );
671671
672672 $ response ->assertStatus (200 )
673- ->assertJsonPath ('data.relationships.groups ' , []);
673+ ->assertJsonPath ('data.relationships.device- groups ' , []);
674674 }
675675
676676 // ── Relationship permission tests ───────────────────────
@@ -829,12 +829,12 @@ public function testCustomRoleCannotSeeUnauthorizedDeviceGroupsViaAlertRule(): v
829829 $ rule ->groups ()->attach ($ groups ->pluck ('id ' ));
830830 Sanctum::actingAs ($ user );
831831
832- $ response = $ this ->getJson ("/api/v1/alert-rules/ {$ rule ->id }?related=groups " );
832+ $ response = $ this ->getJson ("/api/v1/alert-rules/ {$ rule ->id }?related=device- groups " );
833833
834834 $ response ->assertStatus (200 );
835835
836836 // Device groups should be filtered out since user lacks device-group.view
837- $ relationships = $ response ->json ('data.relationships.groups ' );
837+ $ relationships = $ response ->json ('data.relationships.device- groups ' );
838838 $ nonNullGroups = collect ($ relationships )->filter ()->values ();
839839 $ this ->assertEmpty ($ nonNullGroups , 'User without device-group.view should not see related groups ' );
840840 }
0 commit comments