tests/Unit/Private/Get-RemoteFile.tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
InModuleScope Chocolatey {
    Describe Get-RemoteFile {

        Context 'Default' {
            Mock Get-Downloader -MockWith {
                $Obj = [PSCustomObject]@{}
                $obj | Add-member -MemberType ScriptMethod -Name DownloadFile -Value {
                    Param ($url,$file)
                    return @{url=$url;file=$file}
                } -PassThru
            }

            It 'Should Return a downloader object' {
                $result = Get-RemoteFile -url 'https://my/url' -File 'C:\test.zip'
                $result.url | Should be 'https://my/url'
                $result.file | Should be 'C:\test.zip'
            }
        }
    }
}