Skip to content

Commit

Permalink
Merge pull request #34 from ShaunLawrie/prerelease
Browse files Browse the repository at this point in the history
Fix flaky test
  • Loading branch information
ShaunLawrie authored Mar 3, 2024
2 parents 6dee078 + 3a2afa9 commit 467f486
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions PwshSpectreConsole.Tests/TestHelpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ function Get-RandomString {
}

function Get-RandomBoxBorder {
param (
[switch] $MustNotBeNone
)
$lookup = [BoxBorder] | Get-Member -Static -MemberType Properties | Select-Object -ExpandProperty Name
if ($MustNotBeNone) {
$lookup = $lookup | Where-Object { $_ -ne 'None' }
}
return $lookup[$(Get-Random -Minimum 0 -Maximum $lookup.Count)]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Describe "Format-SpectrePanel" {
$testConsole.EmitAnsiSequences = $true
[Spectre.Console.Testing.TestConsoleExtensions]::Width($testConsole, 80)
$testTitle = Get-RandomString -MinimumLength 5 -MaximumLength 10
$testBorder = Get-RandomBoxBorder
$testBorder = Get-RandomBoxBorder -MustNotBeNone
$testExpand = $false
$testColor = Get-RandomColor

Expand Down
2 changes: 1 addition & 1 deletion PwshSpectreConsole/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ if(Test-Path $installLocation) {
if(Test-Path $testingInstallLocation) {
Remove-Item $testingInstallLocation -Recurse -Force
}
Install-SpectreConsole -InstallLocation $installLocation -TestingInstallLocation $testingInstallLocation -Version $Version
Install-SpectreConsole -InstallLocation $installLocation -TestingInstallLocation $testingInstallLocation -Version $Version

0 comments on commit 467f486

Please sign in to comment.