Tests/Private/Assert-AzCopyInstalled.Tests.ps1

BeforeAll {
    . "$PSScriptRoot/../../Private/Assert-AzCopyInstalled.ps1"
}

Describe 'Assert-AzCopyInstalled' {
    Context 'When azcopy is available' {
        BeforeEach {
            Mock Get-Command { [PSCustomObject]@{ Name = 'azcopy' } } -ParameterFilter { $Name -eq 'azcopy' }
        }

        It 'Does not throw' {
            { Assert-AzCopyInstalled } | Should -Not -Throw
        }
    }

    Context 'When azcopy is not available' {
        BeforeEach {
            Mock Get-Command { $null } -ParameterFilter { $Name -eq 'azcopy' }
        }

        It 'Throws with installation hint' {
            { Assert-AzCopyInstalled } | Should -Throw '*azcopy is not installed*'
        }

        It 'Mentions winget in the error message' {
            { Assert-AzCopyInstalled } | Should -Throw '*winget install azcopy*'
        }
    }
}