diff --git a/CHANGELOG.md b/CHANGELOG.md index 8510907..cfded6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,3 +56,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Get-PesterCommandParameter` - Now supports Switch parameters. - Also supports when Switch parameters is the last parameter on the extent. +- Updated conversion documentation for `Should -Invoke`, `Should -Not -Invoke` + and `Should -HaveCount`. diff --git a/source/WikiSource/Pester_v5_Conversion.md b/source/WikiSource/Pester_v5_Conversion.md index 40d91c4..fe6ceb0 100644 --- a/source/WikiSource/Pester_v5_Conversion.md +++ b/source/WikiSource/Pester_v5_Conversion.md @@ -31,6 +31,8 @@ BeNullOrEmpty | `Should-BeFalsy` | `Should-BeTruthy` | See 2) BeOfType | `Should-HaveType` | `Should-NotHaveType` | - BeTrue | `Should-BeTrue` | `Should-BeFalse` | See 4) Contain | `Should-ContainCollection` | `Should-NotContainCollection` | - +HaveCount | `Should-BeCollection -Count` | - | See 5) +Invoke | `Should-Invoke` | `Should-NotInvoke` | - Match | `Should-MatchString` | `Should-NotMatchString` | - MatchExactly | `Should-MatchString -CaseSensitive` | `Should-NotMatchString -CaseSensitive` | - Throw | `Should-Throw` | `$null = & ()` | See 1) @@ -55,3 +57,6 @@ was also possible to pass `$null` to `BeFalse` for it to pass which is not allowed in Pester 6. If this happens then either the code being tested need to be changed to always return boolean value `$true` or `$false`, or change the test to use the Pester 6 commands `Should-BeFalsy` or `Should-BeTruthy`. +5) Negated version of `-HaveCount` will not be converted since there are no +command `Should-NotBeCollection -Count` and using an alternative to it has +not been considered (e.g. `().Count | Should-Be `). diff --git a/tests/Unit/Private/Get-PesterCommandParameter.Tests.ps1 b/tests/Unit/Private/Get-PesterCommandParameter.Tests.ps1 index b5dace3..09e12d8 100644 --- a/tests/Unit/Private/Get-PesterCommandParameter.Tests.ps1 +++ b/tests/Unit/Private/Get-PesterCommandParameter.Tests.ps1 @@ -64,7 +64,7 @@ Describe 'Get-PesterCommandParameter' { $result = Get-PesterCommandParameter -CommandAst $mockCommandAst @mockDefaultParameters $result | Should-HaveType -Expected ([System.Collections.Hashtable]) - $result.Keys.Count | Should -Be 0 + $result.Keys | Should-BeCollection -Count 0 } } } @@ -79,7 +79,7 @@ Describe 'Get-PesterCommandParameter' { $result = Get-PesterCommandParameter -CommandAst $mockCommandAst @mockDefaultParameters $result | Should-HaveType -Expected ([System.Collections.Hashtable]) - $result.Keys.Count | Should -Be 0 + $result.Keys | Should-BeCollection -Count 0 } } }