Skip to content

Commit

Permalink
fix path used by FindVersionHelper and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
anamnavi committed Nov 12, 2024
1 parent efa0184 commit 99a8588
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/code/LocalServerApiCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ private FindResults FindVersionHelper(string packageName, string version, string
{
_cmdletPassedIn.WriteDebug("Found matching version");
string pkgFullName = $"{actualPkgName}.{nugetVersion.ToString()}.nupkg";
pkgPath = Path.Combine(Repository.Uri.LocalPath, pkgFullName);
pkgPath = path;
break;
}
}
Expand Down
9 changes: 8 additions & 1 deletion test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' {
BeforeAll{
$localRepo = "psgettestlocal"
$localUNCRepo = 'psgettestlocal3'
$testModuleName = "test_Local_Mod"
$testModuleName = "test_local_mod"
$testModuleName2 = "test_local_mod2"
$testModuleName3 = "Test_Local_Mod3"
$similarTestModuleName = "test_local_mod.similar"
Expand Down Expand Up @@ -60,6 +60,13 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' {
$res.Version | Should -Be "1.0.0"
}

It "find resource given specific Name with incorrect casing and Version (should return correct casing)" {
# FindName()
$res = Find-PSResource -Name "test_local_mod3" -Version "1.0.0" -Repository $localRepo
$res.Name | Should -Be $testModuleName3
$res.Version | Should -Be "1.0.0"
}

It "find resource given specific Name, Version null (module) from a UNC-based local repository" {
# FindName()
$res = Find-PSResource -Name $testModuleName -Repository $localUNCRepo
Expand Down

0 comments on commit 99a8588

Please sign in to comment.