Improve investor quick search with typed counts, product categories and licensing guidance

This commit is contained in:
2026-11-13 15:06:11 +02:00
parent f53a308327
commit d325b72fad
11 changed files with 508 additions and 21 deletions
+13
View File
@@ -7,6 +7,7 @@ use App\Services\FederatedSearch;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Inertia\Testing\AssertableInertia as Assert;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Tests\TestCase;
final class GlobalSearchTest extends TestCase
@@ -35,6 +36,18 @@ final class GlobalSearchTest extends TestCase
$this->assertSame('Como investir', $result['data'][0]['title']);
}
public function test_unavailable_public_reference_does_not_hide_other_sources_or_swallow_forbidden_access(): void
{
$result = app(FederatedSearch::class)->page([
'Referências' => fn () => throw new HttpException(503),
'Páginas' => fn () => ['count' => 1, 'fetch' => fn () => [['title' => 'Como investir', 'url' => '/como-investir']]],
], 1);
$this->assertSame(1, $result['total']);
$this->assertSame(['Referências'], $result['unavailable']);
$this->expectException(HttpException::class);
app(FederatedSearch::class)->page(['Restrito' => fn () => throw new HttpException(403)], 1);
}
public function test_public_search_uses_the_existing_portfolio_visibility_scope(): void
{
if (getenv('GLOBAL_SEARCH_QA') !== '1') {