Tests/Unit/Public/Discovery/Get-SCAStandingAccessDetail.Tests.ps1

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

Describe 'Get-SCAStandingAccessDetail' {
    InModuleScope psSCA {
        It 'gets detail for the specified id' {
            Mock Invoke-SCARequest { }

            Get-SCAStandingAccessDetail -Id 'identity-1' | Out-Null

            Should -Invoke Invoke-SCARequest -ParameterFilter {
                $Service -eq 'CDS' -and $Method -eq 'GET' -and $Path -eq '/detections/cloud-service-entitlements/{id}' -and
                $PathParameters['id'] -eq 'identity-1'
            }
        }

        It 'accepts ids piped in from Get-SCAStandingAccess-shaped objects' {
            Mock Invoke-SCARequest { }

            [pscustomobject]@{ Id = 'identity-2' } | Get-SCAStandingAccessDetail | Out-Null

            Should -Invoke Invoke-SCARequest -ParameterFilter { $PathParameters['id'] -eq 'identity-2' }
        }
    }
}