create(['name' => 'Acme Industries', 'slug' => 'acme-industries']); $globex = Company::factory()->create(['name' => 'Globex Corporation', 'slug' => 'globex-corp']); $results = Company::query()->searchByTerm('Acme')->pluck('id'); expect($results)->toContain($acme->id) ->not->toContain($globex->id); }); test('searchByTerm returns the query unchanged for a blank term', function () { Company::factory()->count(3)->create(); expect(Company::query()->searchByTerm('')->count())->toBe(Company::query()->count()); }); test('searchByTerm strips a trailing portal abbreviation from the term', function () { $company = Company::factory()->create(['name' => 'Musterfirma']); expect(Company::query()->searchByTerm('Musterfirma (PE)')->pluck('id'))->toContain($company->id); });