write test for the lists
This commit is contained in:
36
tests/Feature/V3/CMMSMachine/ListTest.php
Normal file
36
tests/Feature/V3/CMMSMachine/ListTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\V3\CMMSMachine;
|
||||
|
||||
use App\Models\CMMSMachine;
|
||||
use App\Models\Permission;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ListTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase, WithFaker;
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*/
|
||||
public function test_machine_code_list_return_successfully(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
CMMSMachine::factory(5)->create();
|
||||
|
||||
$response = $this->actingAs($user)->getJson(route('v3.cmms_machines.list'));
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$response->assertJsonStructure([
|
||||
'data' => [
|
||||
'*' => [
|
||||
"machine_code",
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user