1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-24 05:30:07 +00:00

fix(windows): harden visual lookups in logger

This commit is contained in:
Tw93
2026-03-23 20:52:02 +08:00
parent 4a41d56955
commit f1f21a1b60
4 changed files with 132 additions and 49 deletions

View File

@@ -70,6 +70,14 @@ Describe "Base Module" {
$script:Icons.Solid | Should -Be "*"
$script:Icons.Admin | Should -Not -BeNullOrEmpty
}
It "Should restore missing icon entries on demand" {
$script:Icons = @{ Solid = "*" }
(Get-MoleIcon -Name "Error") | Should -Not -BeNullOrEmpty
$script:Icons.Error | Should -Not -BeNullOrEmpty
$script:Icons.Solid | Should -Be "*"
}
}
Context "Test-IsAdmin" {
@@ -242,6 +250,19 @@ Describe "Logging Module" {
# Note: The actual function is Write-MoleError
{ Write-MoleError "Test message" } | Should -Not -Throw
}
It "Should log errors even when the icon table is partial" {
$originalIcons = $script:Icons.Clone()
try {
$script:Icons = @{ Solid = "*" }
{ Write-MoleError "Test message" } | Should -Not -Throw
$script:Icons.Error | Should -Not -BeNullOrEmpty
}
finally {
$script:Icons = $originalIcons
}
}
}
Context "Section Functions" {