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

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

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

            It 'Should Return a downloader object' {
                $result = Get-RemoteString -url 'https://my/url'
                $result.url | Should be 'https://my/url'
            }
        }
    }
}