Fix TimeZone test with duplicate names - #27525
Merged
Justin Chung (jshigetomi) merged 3 commits intoAug 10, 2026
Merged
Justin Chung (jshigetomi) merged 3 commits into
Justin Chung (jshigetomi) merged 3 commits into
Conversation
Kirtikumar Anandrao Ramchandani (KirtiRamchandani)
requested a review
from a team
as a code owner
May 25, 2026 01:17
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the Get-TimeZone tests to ensure -Name returns a single, deterministic match by selecting a time zone with a unique StandardName.
Changes:
- Fixes a typo in the test description (“singe” → “single”).
- Updates the
-Nametest to pick a time zone whoseStandardNamemaps to exactly one entry. - Strengthens assertions by validating both
IdandStandardName.
| Group-Object -Property StandardName | | ||
| Where-Object Count -EQ 1 | | ||
| Select-Object -First 1 -ExpandProperty Group | ||
|
|
Justin Chung (jshigetomi)
approved these changes
Aug 10, 2026
Justin Chung (jshigetomi)
merged commit Aug 10, 2026
91ce984
into
PowerShell:master
105 of 128 checks passed
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Make the
Get-TimeZone -Namesingle-item test choose a timezone with a uniqueStandardName.PR Context
The previous test used the first available timezone's
StandardName. On tzdata sets where that name has aliases,Get-TimeZone -Namecan validly return more than one timezone and the scalar assertion fails. This updates the test to pick aStandardNamethat appears exactly once in the available timezone list, then asserts both the returned ID and standard name.Fixes #27502
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerTests
Start-PSPester -Path ./test/powershell/Modules/Microsoft.PowerShell.Management/TimeZone.Tests.ps1 -UseNuGetOrg -SkipTestToolBuild -ThrowOnFailure(14 passed)git diff --check