From f957578e21c20d9c4752f4f08661985138da9ead Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Sat, 16 May 2026 09:11:14 -0700 Subject: [PATCH] fix(tests): mock Install-Dotnet in DotnetSdk install test The test was calling the real dotnet-install script, which requires network access and produces no local artifacts on CI runners. Replace the filesystem assertion with a Should -Invoke check against a proper Install-Dotnet mock. Co-Authored-By: Claude Sonnet 4.6 --- Tests/PSModuleGallery.Type.Tests.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tests/PSModuleGallery.Type.Tests.ps1 b/Tests/PSModuleGallery.Type.Tests.ps1 index 81c91ed..76d709d 100644 --- a/Tests/PSModuleGallery.Type.Tests.ps1 +++ b/Tests/PSModuleGallery.Type.Tests.ps1 @@ -1176,10 +1176,13 @@ Describe "PSModuleGallery Type" -Tag 'Integration' { } It 'Installs the .NET Core SDK to the specified directory' { - Mock Test-Dotnet { return $false } -ModuleName PSDepend + Mock Test-Dotnet { return $false } -ModuleName PSDepend + Mock Install-Dotnet { } -ModuleName PSDepend Invoke-PSDepend @Verbose -Path "$TestDepends\dotnetsdk.complex.depend.psd1" -Force - Test-Path $script:SavePath | Should -BeTrue + Should -Invoke Install-Dotnet -Times 1 -Exactly -ModuleName PSDepend -ParameterFilter { + $InstallDir -eq $script:SavePath + } } It 'Does nothing if the .NET Core SDK is found' {