A free open source IT asset/license management system
Add simple test case for assets
Marcus Moore918239961ab1
diff --git a/tests/Feature/Api/Assets/AssetIndexTest.php b/tests/Feature/Api/Assets/AssetIndexTest.phpnew file mode 100644index 0000000000..2190c791f6--- /dev/null+++ b/tests/Feature/Api/Assets/AssetIndexTest.php@@ -0,0 +1,35 @@+<?php++namespace Tests\Feature\Api\Assets;++use App\Models\Asset;+use App\Models\Setting;+use App\Models\User;+use Illuminate\Testing\Fluent\AssertableJson;+use Laravel\Passport\Passport;+use Tests\TestCase;++class AssetIndexTest extends TestCase+{+ public function testAssetIndexReturnsExpectedAssets()+ {+ Setting::factory()->create();++ Asset::factory()->count(3)->create();++ Passport::actingAs(User::factory()->superuser()->create());+ $this->getJson(+ route('api.assets.index', [+ 'sort' => 'name',+ 'order' => 'asc',+ 'offset' => '0',+ 'limit' => '20',+ ]))+ ->assertOk()+ ->assertJsonStructure([+ 'total',+ 'rows',+ ])+ ->assertJson(fn(AssertableJson $json) => $json->has('rows', 3)->etc());+ }+}