Tests/Private/Invoke-CmdKey.Tests.ps1

BeforeAll {
    . "$PSScriptRoot/../../Private/Invoke-CmdKey.ps1"
}

Describe 'Invoke-CmdKey' {
    Context 'When called with arguments' {
        It 'Has the expected function definition' {
            $cmd = Get-Command Invoke-CmdKey
            $cmd | Should -Not -BeNullOrEmpty
        }

        It 'Has an Arguments parameter that allows empty collections' {
            $param = (Get-Command Invoke-CmdKey).Parameters['Arguments']
            $param | Should -Not -BeNullOrEmpty
            $param.Attributes | Where-Object { $_ -is [System.Management.Automation.AllowEmptyCollectionAttribute] } |
                Should -Not -BeNullOrEmpty
        }

        It 'Returns string output type' {
            $cmd = Get-Command Invoke-CmdKey
            $outputType = $cmd.OutputType
            $outputType.Type | Should -Contain ([string[]])
        }
    }
}