A free open source IT asset/license management system
Improve assertions
Marcus Mooreab7bd8633636
diff --git a/tests/Feature/Assets/Api/AssignedAssetsTest.php b/tests/Feature/Assets/Api/AssignedAssetsTest.phpindex 2b0fec16c1..e62b677405 100644--- a/tests/Feature/Assets/Api/AssignedAssetsTest.php+++ b/tests/Feature/Assets/Api/AssignedAssetsTest.php@@ -5,6 +5,7 @@ namespace Tests\Feature\Assets\Api;use App\Models\Asset;use App\Models\Company;use App\Models\User;+use Illuminate\Testing\Fluent\AssertableJson;use Tests\TestCase;class AssignedAssetsTest extends TestCase@@ -48,7 +49,12 @@ class AssignedAssetsTest extends TestCase->getJson(route('api.assets.assigned_assets', $asset))->assertOk()->assertResponseContainsInRows($assetsAssignedToAsset, 'serial')- ->assertResponseDoesNotContainInRows($unassociatedAsset, 'serial');+ ->assertResponseDoesNotContainInRows($unassociatedAsset, 'serial')+ ->assertJson(function (AssertableJson $json) {+ $json->where('total', 2)+ ->count('rows', 2)+ ->etc();+ });}public function test_adheres_to_offset_and_limit()@@ -68,6 +74,12 @@ class AssignedAssetsTest extends TestCase]))->assertOk()->assertResponseDoesNotContainInRows($assetsAssignedToAsset->first(), 'serial')- ->assertResponseContainsInRows($assetsAssignedToAsset->last(), 'serial');+ ->assertResponseContainsInRows($assetsAssignedToAsset->last(), 'serial')+ ->dump()+ ->assertJson(function (AssertableJson $json) {+ $json->where('total', 2)+ ->count('rows', 1)+ ->etc();+ });}}