1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-24 20:25:06 +00:00

fix(windows): harden PowerShell startup fallbacks

This commit is contained in:
Tw93
2026-03-24 10:30:46 +08:00
parent dadc28e5a5
commit e29e1976ec
2 changed files with 48 additions and 21 deletions

View File

@@ -35,6 +35,18 @@ Describe "Base Module" {
$script:Icons.Admin | Should -Not -BeNullOrEmpty
$script:Icons.Trash | Should -Not -BeNullOrEmpty
}
It "Should expose the full icon table in Windows PowerShell" {
$basePath = (Join-Path $script:LibDir "core\base.ps1").Replace("'", "''")
$psCommand = "& { . '$basePath'; `$icons = Get-MoleDefaultIcons; [pscustomobject]@{ Count = `$icons.Count; HasSolid = `$icons.ContainsKey('Solid'); HasAdmin = `$icons.ContainsKey('Admin'); HasSuccess = `$icons.ContainsKey('Success') } | ConvertTo-Json -Compress }"
$result = & powershell -NoProfile -ExecutionPolicy Bypass -Command $psCommand
$iconInfo = $result | ConvertFrom-Json
$iconInfo.Count | Should -Be 15
$iconInfo.HasSolid | Should -Be $true
$iconInfo.HasAdmin | Should -Be $true
$iconInfo.HasSuccess | Should -Be $true
}
}
Context "Visual Defaults Initialization" {