byos_laravel/tests/Feature/Api/DeviceModelsEndpointTest.php
Benjamin Nussbaum ba3bf31bb7
Some checks are pending
tests / ci (push) Waiting to run
feat: adapt device models api
2025-08-17 01:16:34 +02:00

35 lines
836 B
PHP

<?php
declare(strict_types=1);
use App\Models\User;
use Laravel\Sanctum\Sanctum;
it('allows an authenticated user to fetch device models', function (): void {
$user = User::factory()->create();
Sanctum::actingAs($user);
$response = $this->getJson('/api/device-models');
$response->assertOk()
->assertJsonStructure([
'data' => [
'*' => [
'id',
'name',
'label',
'description',
'width',
'height',
'bit_depth',
],
],
]);
});
it('blocks unauthenticated users from accessing device models', function (): void {
$response = $this->getJson('/api/device-models');
$response->assertUnauthorized();
});