tests/SoftwareUpdater.Tests.ps1

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

Describe 'Invoke-OctaSoftwareUpdater' {
    It 'dry-run (no -Apply) never attempts an actual update and reports manager availability' {
        $result = @(Invoke-OctaSoftwareUpdater)
        $winget = $result | Where-Object Manager -eq 'winget'
        $winget.Available | Should Be $true
    }

    It 'reports Chocolatey/Scoop as unavailable rather than erroring when their executables are absent (real condition on this dev machine, research.md)' {
        $result = @(Invoke-OctaSoftwareUpdater)
        $choco = $result | Where-Object Manager -eq 'Chocolatey'
        $scoop = $result | Where-Object Manager -eq 'Scoop'
        $choco | Should Not Be $null
        $scoop | Should Not Be $null
        # Availability itself is real/environment-dependent - just confirm the shape never throws
        # and always reports a boolean, never null/error.
        $choco.Available | Should Not Be $null
        $scoop.Available | Should Not Be $null
    }
}