Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunLawrie committed Nov 27, 2023
1 parent 469d4e2 commit 396db1a
Showing 1 changed file with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,32 @@ BeforeAll {
}

Describe "Format-SpectreBarChart" {
Context "WhenThingsHappen" {
BeforeEach {
Mock Write-AnsiConsole {
Write-Host "FUUUCK"
}
InModuleScope "PwshSpectreConsole" {
Context "WhenThingsHappen" {
BeforeEach {
Mock Write-AnsiConsole {}

Mock Convert-ToSpectreColor {
Write-Host "FUUUCK2"
Mock Convert-ToSpectreColor {}
}
}

It "Should create a bar chart with correct width" {
$data = @(
@{ Label = "Apples"; Value = 10; Color = "Green" },
@{ Label = "Oranges"; Value = 5; Color = "Yellow" },
@{ Label = "Bananas"; Value = 3; Color = "Red" }
)
Format-SpectreBarChart -Data $data -Title "Fruit Sales" -Width 50
Assert-MockCalled -CommandName "Write-AnsiConsole" -Times 1 -Exactly
}
It "Should create a bar chart with correct width" {
$data = @(
@{ Label = "Apples"; Value = 10; Color = "Green" },
@{ Label = "Oranges"; Value = 5; Color = "Yellow" },
@{ Label = "Bananas"; Value = 3; Color = "Red" }
)
Format-SpectreBarChart -Data $data -Title "Fruit Sales" -Width 50
Assert-MockCalled -CommandName "Write-AnsiConsole" -Times 1 -Exactly
}

It "Should handle single item data correctly" {
Mock Write-AnsiConsole {
Write-Host "FUUUCK1"
It "Should handle single item data correctly" {
Mock Write-AnsiConsole {
Write-Host "FUUUCK1"
}
$data = @{ Label = "Apples"; Value = 10; Color = "Green" }
Format-SpectreBarChart -Data $data -Title "Fruit Sales" -Width 50
Assert-MockCalled Write-AnsiConsole -Times 1 -Exactly
}
$data = @{ Label = "Apples"; Value = 10; Color = "Green" }
Format-SpectreBarChart -Data $data -Title "Fruit Sales" -Width 50
Assert-MockCalled Write-AnsiConsole -Times 1 -Exactly
}
}
}

0 comments on commit 396db1a

Please sign in to comment.