feat(#169): add mirroring section to device configuration
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2026-02-07 00:02:48 +01:00
parent e3ac975321
commit 35ca55a90b
2 changed files with 60 additions and 0 deletions

View file

@ -5,6 +5,7 @@ namespace Tests\Feature;
use App\Models\Device;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use function Pest\Laravel\actingAs;
@ -23,3 +24,35 @@ test('configure view displays last_refreshed_at timestamp', function (): void {
$response->assertOk()
->assertSee('5 minutes ago');
});
test('configure edit modal shows mirror checkbox and allows unchecking mirror', function (): void {
$user = User::factory()->create();
actingAs($user);
$deviceAttributes = [
'user_id' => $user->id,
'width' => 800,
'height' => 480,
'rotate' => 0,
'image_format' => 'png',
'maximum_compatibility' => false,
];
$sourceDevice = Device::factory()->create($deviceAttributes);
$mirrorDevice = Device::factory()->create([
...$deviceAttributes,
'mirror_device_id' => $sourceDevice->id,
]);
$response = $this->get(route('devices.configure', $mirrorDevice));
$response->assertOk()
->assertSee('Mirrors Device')
->assertSee('Select Device to Mirror');
Livewire::test('devices.configure', ['device' => $mirrorDevice])
->set('is_mirror', false)
->call('updateDevice')
->assertHasNoErrors();
$mirrorDevice->refresh();
expect($mirrorDevice->mirror_device_id)->toBeNull();
});