Skip to content

Commit

Permalink
Add because to should-befasterthan (#2620)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd authored Feb 20, 2025
1 parent 3808d3c commit 52b044d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/functions/assert/Time/Should-BeFasterThan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
[Parameter(Position = 1, ValueFromPipeline = $true)]
$Actual,
[Parameter(Position = 0)]
$Expected
$Expected,
[string] $Because
)

if ($Expected -isnot [timespan]) {
Expand Down
6 changes: 6 additions & 0 deletions tst/functions/assert/Time/Should-BeFasterThan.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ Describe "Should-BeFasterThan" {
) {
{ $Actual | Should-BeFasterThan -Expected $Expected } | Verify-AssertionFailed
}

It "Has Because parameter" -ForEach @(
@{ Actual = { Start-Sleep -Milliseconds 10 }; Expected = "1ms"; Because = "I said so" }
) {
{ $Actual | Should-BeFasterThan -Expected $Expected -Because $Because } | Verify-AssertionFailed
}
}

0 comments on commit 52b044d

Please sign in to comment.