diff --git a/PwshSpectreConsole.Tests/formatting/Format-SpectreBarChart.tests.ps1 b/PwshSpectreConsole.Tests/formatting/Format-SpectreBarChart.tests.ps1 index 43473417..1ac38e10 100644 --- a/PwshSpectreConsole.Tests/formatting/Format-SpectreBarChart.tests.ps1 +++ b/PwshSpectreConsole.Tests/formatting/Format-SpectreBarChart.tests.ps1 @@ -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 } } } \ No newline at end of file