Skip to content

Commit

Permalink
Update documentation (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju authored Feb 8, 2025
1 parent ad62ce0 commit 24948be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
5 changes: 5 additions & 0 deletions source/WikiSource/Pester_v5_Conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = & (<ActualValue>)` | See 1)
Expand All @@ -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. `(<code>).Count | Should-Be <expected value>`).
4 changes: 2 additions & 2 deletions tests/Unit/Private/Get-PesterCommandParameter.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand All @@ -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
}
}
}
Expand Down

0 comments on commit 24948be

Please sign in to comment.