File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,6 +276,8 @@ Please run the command again with elevated rights (Run as Administrator) or prov
276276 }
277277
278278 clean {
279- Remove-Item - Path $tempPath - Force
279+ if ($tempPath -and (Test-Path - LiteralPath $tempPath )) {
280+ Remove-Item - LiteralPath $tempPath - Force - Recurse - ErrorAction SilentlyContinue
281+ }
280282 }
281283}
Original file line number Diff line number Diff line change @@ -98,9 +98,28 @@ Describe 'Module' {
9898 Get-Font - Name ' Hack*' | Should -Not - BeNullOrEmpty
9999 }
100100
101- It ' Install-NerdFont - Installs all fonts' {
102- { Install-NerdFont - All - Verbose } | Should -Not - Throw
103- Get-Font - Name ' VictorMono*' | Should -Not - BeNullOrEmpty
101+ It ' Install-NerdFont - Handles -All without downloading already installed fonts' {
102+ . (Join-Path - Path $PSScriptRoot - ChildPath ' ..\src\functions\public\Install-NerdFont.ps1' )
103+
104+ $originalFonts = $script :NerdFonts
105+ $script :NerdFonts = @ (
106+ [pscustomobject ]@ {
107+ Name = ' AllPathSmokeTest'
108+ URL = ' https://example.invalid/all-path-smoke.zip'
109+ }
110+ )
111+
112+ try {
113+ Mock Get-Font {
114+ [pscustomobject ]@ { Name = ' AllPathSmokeTest Nerd Font' }
115+ }
116+ Mock Install-Font {}
117+
118+ { Install-NerdFont - All - Verbose - ErrorAction Stop } | Should -Not - Throw
119+ Should - Invoke Install-Font - Times 0 - Exactly
120+ } finally {
121+ $script :NerdFonts = $originalFonts
122+ }
104123 }
105124 }
106125}
You can’t perform that action at this time.
0 commit comments