tests/Unit/Public/Remove-ChocolateyPin.tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
InModuleScope Chocolatey {

    Describe "Remove-ChocolateyPin" {

        Mock -CommandName Remove-ChocolateyPin -MockWith {
            $properties = @{
                Name    = 'TestPackage'
                Version = '1.0.0'
            }

            return (New-Object -TypeName PSObject -Property $properties)
        }

        $results = Remove-ChocolateyPin -Name 'TestPackage'

        It 'Should return an PSCustomObject' {
            $results.GetType().Name | Should -Be 'PSCustomObject'
        }

        It 'Should return a Package with name TestPackage' {
            $results.Name | Should -Be 'TestPackage'
        }
    }
}