<?php

declare(strict_types=1);

use App\Support\Workspaces\WorkspaceContext;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

final class TenantListRedirectTest extends TestCase
{
    use RefreshDatabase;

    public function test_returns_not_found_for_legacy_tenant_scoped_operations_list_url(): void
    {
        [$user, $tenant] = createUserWithTenant(role: 'owner');

        Filament::setTenant($tenant, true);

        $this->actingAs($user)
            ->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
            ->get('/admin/t/'.$tenant->external_id.'/operations')
            ->assertNotFound();
    }
}
