From af0a95be12fbe3b12ec710e95935fa1dcb54bc74 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 21 Aug 2024 17:00:32 -0700 Subject: [PATCH] Simplify assertions --- .../Feature/AssetModels/Ui/UpdateAssetModelsTest.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php index 83ffce7c91..95eb592b6d 100644 --- a/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php +++ b/tests/Feature/AssetModels/Ui/UpdateAssetModelsTest.php @@ -90,13 +90,10 @@ class UpdateAssetModelsTest extends TestCase ], ]); - $this->assertEquals( - 2, - $assetModel->fresh()->defaultValues->filter(function (CustomField $field) { - return in_array($field->pivot->default_value, ['first default value', 'second default value']); - })->count(), - 'Default field values were changed unexpectedly.' - ); + $potentiallyChangedDefaultValues = $assetModel->defaultValues->pluck('pivot.default_value'); + $this->assertCount(2, $potentiallyChangedDefaultValues); + $this->assertContains('first default value', $potentiallyChangedDefaultValues); + $this->assertContains('second default value', $potentiallyChangedDefaultValues); } public function test_default_values_can_be_updated() @@ -129,7 +126,6 @@ class UpdateAssetModelsTest extends TestCase ]); $potentiallyChangedDefaultValues = $assetModel->defaultValues->pluck('pivot.default_value'); - $this->assertCount(2, $potentiallyChangedDefaultValues); $this->assertContains('first changed value', $potentiallyChangedDefaultValues); $this->assertContains('second changed value', $potentiallyChangedDefaultValues);