write test for another items and change some part of the code

This commit is contained in:
2025-05-14 15:38:33 +03:30
parent db8cda55df
commit 16fe0be555
20 changed files with 1258 additions and 45 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Tests\Feature\Province;
use App\Models\Province;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class ListTest extends TestCase
{
use refreshDatabase, WithFaker;
public function test_user_can_view_list():void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->getJson(route('provinces.list'));
Province::factory()->count(3)->create();
$response->assertOk();
$response->assertJsonStructure([
'data' => [
'*' => [
'id',
'name'
],
]
]);
}
}