write tests for azmayesh resources
This commit is contained in:
55
tests/Feature/V3/Azmayesh/IndexTest.php
Normal file
55
tests/Feature/V3/Azmayesh/IndexTest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\V3\Azmayesh;
|
||||
|
||||
use App\Models\Azmayesh;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Tests\TestCase;
|
||||
|
||||
class IndexTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase, WithFaker;
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*/
|
||||
public function test_all_azmayeshes_returned_successfully(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
Azmayesh::factory(5)->create();
|
||||
|
||||
$response = $this->actingAs($user)->getJson(route('v3.azmayeshes.index', [
|
||||
'start' => 0,
|
||||
'size' => 10,
|
||||
'filters' => json_encode([]),
|
||||
'sorting' => json_encode([]),
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$response->assertJsonStructure([
|
||||
'data' => [
|
||||
'*' => [
|
||||
'id',
|
||||
'lat',
|
||||
'lng',
|
||||
'request_date',
|
||||
'report_date',
|
||||
'request_number',
|
||||
'employer',
|
||||
'contractor',
|
||||
'work_number',
|
||||
'consultant',
|
||||
'applicant',
|
||||
'project_name',
|
||||
'province_id',
|
||||
],
|
||||
],
|
||||
"meta" => [
|
||||
"totalRowCount"
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user