<?php

namespace Tests\Unit;

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

class HeaderGlobalSearchTest extends TestCase
{
    use RefreshDatabase;

    protected function setUp(): void
    {
        parent::setUp();
        $this->seed();
    }

    public function test_header_global_search_returns_matched_results(): void
    {
        $admin = User::where('email', 'admin@smkn1gunungagung.sch.id')->first();
        $this->actingAs($admin);

        Livewire::test(\App\Livewire\HeaderGlobalSearch::class)
            ->set('query', 'Admin')
            ->assertSee('Admin Tata Usaha');
    }
}
