Skip to content

A free open source IT asset/license management system

Populate test

Marcus Moore73e0628124bf
diff --git a/tests/Feature/Assets/Api/AssignedComponentsTest.php b/tests/Feature/Assets/Api/AssignedComponentsTest.php
index 9a5d7f28bb..ad5ce43349 100644
--- a/tests/Feature/Assets/Api/AssignedComponentsTest.php
+++ b/tests/Feature/Assets/Api/AssignedComponentsTest.php
@@ -57,6 +57,23 @@ class AssignedComponentsTest extends TestCase
public function test_adheres_to_offset_and_limit()
{
- $this->markTestIncomplete();
+ $asset = Asset::factory()->hasComponents(2)->create();
+
+ $componentsAssignedToAsset = $asset->components;
+
+ $this->actingAsForApi(User::factory()->viewAssets()->create())
+ ->getJson(route('api.assets.assigned_components', [
+ 'asset' => $asset,
+ 'offset' => 1,
+ 'limit' => 1,
+ ]))
+ ->assertOk()
+ ->assertResponseDoesNotContainInRows($componentsAssignedToAsset->first())
+ ->assertResponseContainsInRows($componentsAssignedToAsset->last())
+ ->assertJson(function (AssertableJson $json) {
+ $json->where('total', 2)
+ ->count('rows', 1)
+ ->etc();
+ });
}
}