<?php

declare(strict_types=1);

use App\Filament\Resources\ManagedEnvironmentResource;
use App\Support\Links\RequiredPermissionsLinks;

it('renders re-run verification and next-step links using canonical manage surfaces only', function (): void {
    [$user, $tenant] = createUserWithTenant(role: 'readonly');

    $expectedUrl = ManagedEnvironmentResource::getUrl('view', ['record' => $tenant]);

    $this->actingAs($user)
        ->get(RequiredPermissionsLinks::requiredPermissions($tenant))
        ->assertSuccessful()
        ->assertSee('Re-run verification')
        ->assertSee($expectedUrl, false)
        ->assertDontSee('/admin/t/', false);
});

it('renders sections in summary-issues-passed-technical order and keeps technical details collapsed by default', function (): void {
    [$user, $tenant] = createUserWithTenant(role: 'readonly');

    $this->actingAs($user)
    ->get(RequiredPermissionsLinks::requiredPermissions($tenant))
        ->assertSuccessful()
        ->assertSeeInOrder(['Summary', 'Issues', 'Passed', 'Technical details'])
        ->assertSee('data-testid="technical-details"', false)
        ->assertDontSee('data-testid="technical-details" open', false);
});
