@@ -10,6 +10,7 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' {
1010 BeforeAll {
1111 $testModuleName = " test-module"
1212 $testModuleName2 = " test-module2"
13+ $testModuleWith2DigitVersion = " test-2DigitPkg"
1314 $testCamelCaseModuleName = " test-camelCaseModule"
1415 $testCamelCaseScriptName = " test-camelCaseScript"
1516 $testModuleParentName = " test_parent_mod"
@@ -33,7 +34,7 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' {
3334 }
3435
3536 AfterEach {
36- Uninstall-PSResource $testModuleName , $testModuleName2 , $testCamelCaseModuleName , $testScriptName , $testCamelCaseScriptName - Version " *" - SkipDependencyCheck - ErrorAction SilentlyContinue
37+ Uninstall-PSResource $testModuleName , $testModuleName2 , $testCamelCaseModuleName , $testScriptName , $testCamelCaseScriptName , $testModuleWith2DigitVersion - Version " *" - SkipDependencyCheck - ErrorAction SilentlyContinue
3738 }
3839
3940 AfterAll {
@@ -75,6 +76,47 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' {
7576 $pkg.Version | Should - BeExactly " 1.0.0"
7677 }
7778
79+ It " Install resource when version contains different number of digits than the normalized version- 1 digit specified" {
80+ # the resource has version "1.0", but querying with any equivalent version should work
81+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1" - Repository $ACRRepoName - TrustRepository
82+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
83+ $res | Should -Not - BeNullOrEmpty
84+ $res.Version | Should - Be " 1.0"
85+ }
86+
87+ It " Install resource when version contains different number of digits than the normalized version- 2 digits specified" {
88+ # the resource has version "1.0", but querying with any equivalent version should work
89+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.0" - Repository $ACRRepoName - TrustRepository
90+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
91+ $res | Should -Not - BeNullOrEmpty
92+ $res.Version | Should - Be " 1.0"
93+ }
94+
95+ It " Install resource when version contains different number of digits than the normalized version- 3 digits specified" {
96+ # the resource has version "1.0", but querying with any equivalent version should work
97+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.0.0" - Repository $ACRRepoName - TrustRepository
98+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
99+ $res | Should -Not - BeNullOrEmpty
100+ $res.Version | Should - Be " 1.0"
101+ }
102+
103+ It " Install resource when version contains different number of digits than the normalized version- 4 digits specified" {
104+ # the resource has version "1.0", but querying with any equivalent version should work
105+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.0.0.0" - Repository $ACRRepoName - TrustRepository
106+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
107+ $res | Should -Not - BeNullOrEmpty
108+ $res.Version | Should - Be " 1.0"
109+ }
110+
111+ It " Install resource where version specified is a prerelease version" {
112+ # the resource has version "1.0", but querying with any equivalent version should work
113+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.5-alpha" - Prerelease - Repository $ACRRepoName - TrustRepository
114+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
115+ $res | Should -Not - BeNullOrEmpty
116+ $res.Version | Should - Be " 1.5"
117+ $res.Prerelease | Should - Be " alpha"
118+ }
119+
78120 It " Install multiple resources by name" {
79121 $pkgNames = @ ($testModuleName , $testModuleName2 )
80122 Install-PSResource - Name $pkgNames - Repository $ACRRepoName - TrustRepository
0 commit comments