<?php

declare(strict_types=1);

use App\Support\Links\RequiredPermissionsLinks;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

it('renders required permissions with provider capability grouping before raw permission detail', function (): void {
    [$user, $tenant] = createUserWithTenant(role: 'readonly');

    $this->actingAs($user)
        ->get(RequiredPermissionsLinks::requiredPermissions($tenant, ['status' => 'all']))
        ->assertSuccessful()
        ->assertSee('Provider capabilities')
        ->assertSee('Inventory read')
        ->assertSee('Directory role definitions read')
        ->assertSeeInOrder(['Provider capabilities', 'Technical details'], false);
});
