<?php

namespace Tests\Feature;

use App\Livewire\Dashboard;
use App\Models\AuditEvent;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;

class DashboardAuditTest extends TestCase
{
    use RefreshDatabase;

    public function test_dashboard_recent_events_use_readable_labels(): void
    {
        $this->actingAs(User::factory()->create(['must_change_password' => false]));
        AuditEvent::create(['actor' => 'Administrator', 'action' => 'wg.set-endpoint', 'target' => '203.0.113.10', 'ip' => '127.0.0.1']);

        Livewire::test(Dashboard::class)
            ->assertSee('WireGuard-Endpoint geändert')   // readable label
            ->assertDontSee('wg.set-endpoint');           // not the raw code
    }
}
