Tests/Unit/Public/Access/Get-SCAEligibleTarget.Tests.ps1

Import-Module (Join-Path $PSScriptRoot '../../../../psSCA.psd1') -Force

Describe 'Get-SCAEligibleTarget' {
    InModuleScope psSCA {
        It 'calls the eligibility endpoint with the lowercased provider as the csp path parameter' {
            Mock Invoke-SCARequest { }

            Get-SCAEligibleTarget -Provider AWS | Out-Null

            Should -Invoke Invoke-SCARequest -ParameterFilter {
                $Service -eq 'SCA' -and $Method -eq 'GET' -and $Path -eq '/access/{csp}/eligibility' -and
                $PathParameters['csp'] -eq 'aws' -and $TypeName -eq 'psSCA.EligibleTarget'
            }
        }

        It 'rejects a provider outside AWS, Azure, GCP' {
            { Get-SCAEligibleTarget -Provider Oracle } | Should -Throw
        }
    }
}