tests/Octa.Tests.ps1

$moduleRoot = Split-Path -Parent $PSScriptRoot
Import-Module (Join-Path $moduleRoot 'Octa.psd1') -Force

Describe 'Octa module' {
    It 'imports without error and exports the expected commands' {
        $commands = Get-Command -Module Octa | Select-Object -ExpandProperty Name
        ($commands -contains 'Get-OctaCategory') | Should Be $true
        ($commands -contains 'Invoke-OctaCategory') | Should Be $true
    }
}

Describe 'Show-OctaMenu' {
    It 'fails fast with a clear error instead of looping forever when no console is attached' {
        InModuleScope Octa {
            $items = @([pscustomobject]@{ Key = 'x'; Label = 'Exit'; Description = '' })
            { Show-OctaMenu -Items $items -Header 'Test' } | Should Throw 'real console'
        }
    }
}