mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
This commit is contained in:
parent
a88e72b75e
commit
ba3bf31bb7
29 changed files with 2379 additions and 215 deletions
35
tests/Feature/Api/DeviceModelsEndpointTest.php
Normal file
35
tests/Feature/Api/DeviceModelsEndpointTest.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?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();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue