<?php

use App\Models\Person\Person;

it('finds a person when the query uses the inverted name order', function (): void {
    config()->set('scout.driver', 'collection');

    $person = Person::factory()->create([
        'first_name' => 'John',
        'last_name' => 'Dou',
        'full_name' => 'Dou John',
    ]);

    $results = Person::search('John Dou')->get();

    expect($results)->toHaveCount(1)
        ->and($results->first()->is($person))->toBeTrue();
});
