Skip to content

Commit 7ca2b72

Browse files
authored
Fix a preview detection test for the packaging script (#26882)
1 parent cfd5966 commit 7ca2b72

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

test/packaging/packaging.tests.ps1

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,15 @@ Describe "Packaging Module Functions" {
4646
$result.PackageIdentifier | Should -Be "com.microsoft.powershell"
4747
}
4848

49-
It "Should NOT use package name for preview detection (bug fix verification)" {
49+
It "Should NOT use package name for preview detection (bug fix verification) - <Name>" -TestCases @(
50+
@{ Version = "7.6.0-preview.6"; Name = "Preview" }
51+
@{ Version = "7.6.0-rc.1"; Name = "RC" }
52+
) {
5053
# This test verifies the fix for issue #26673
5154
# The bug was using ($Name -like '*-preview') which always returned false
5255
# because preview builds use Name="powershell" not "powershell-preview"
53-
54-
$Version = "7.6.0-preview.6"
55-
$Name = "powershell" # Preview builds use "powershell" not "powershell-preview"
56-
57-
# The INCORRECT logic (the bug): $Name -like '*-preview'
58-
$incorrectCheck = $Name -like '*-preview'
59-
$incorrectCheck | Should -Be $false -Because "Package name is 'powershell' not 'powershell-preview'"
60-
56+
param($Version)
57+
6158
# The CORRECT logic (the fix): uses version string
6259
$result = Get-MacOSPackageIdentifierInfo -Version $Version -LTS:$false
6360
$result.IsPreview | Should -Be $true -Because "Version string correctly identifies preview"

0 commit comments

Comments
 (0)