Files
backend/tests/Feature/Province/ListTest.php

33 lines
732 B
PHP

<?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'
],
]
]);
}
}