From 918239961ab166e2f09d462c22e52adee76a355b Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 20 Mar 2023 15:47:57 -0700 Subject: [PATCH] Add simple test case for assets --- tests/Feature/Api/Assets/AssetIndexTest.php | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/Feature/Api/Assets/AssetIndexTest.php diff --git a/tests/Feature/Api/Assets/AssetIndexTest.php b/tests/Feature/Api/Assets/AssetIndexTest.php new file mode 100644 index 0000000000..2190c791f6 --- /dev/null +++ b/tests/Feature/Api/Assets/AssetIndexTest.php @@ -0,0 +1,35 @@ +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()); + } +}