Skip to content

Fix TimeZone test with duplicate names - #27525

Merged
Justin Chung (jshigetomi) merged 3 commits into
PowerShell:masterfrom
KirtiRamchandani:fix/timezone-name-alias-test
Aug 10, 2026
Merged

Justin Chung (jshigetomi) merged 3 commits into
PowerShell:masterfrom
KirtiRamchandani:fix/timezone-name-alias-test

Conversation

@KirtiRamchandani

Copy link
Copy Markdown
Contributor

PR Summary

Make the Get-TimeZone -Name single-item test choose a timezone with a unique StandardName.

PR Context

The previous test used the first available timezone's StandardName. On tzdata sets where that name has aliases, Get-TimeZone -Name can validly return more than one timezone and the scalar assertion fails. This updates the test to pick a StandardName that appears exactly once in the available timezone list, then asserts both the returned ID and standard name.

Fixes #27502

PR Checklist

Tests

  • Start-PSPester -Path ./test/powershell/Modules/Microsoft.PowerShell.Management/TimeZone.Tests.ps1 -UseNuGetOrg -SkipTestToolBuild -ThrowOnFailure (14 passed)
  • git diff --check

Copilot AI review requested due to automatic review settings May 25, 2026 01:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 -Name test to pick a time zone whose StandardName maps to exactly one entry.
  • Strengthens assertions by validating both Id and StandardName.

Group-Object -Property StandardName |
Where-Object Count -EQ 1 |
Select-Object -First 1 -ExpandProperty Group

@jshigetomi Justin Chung (jshigetomi) added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.4.x-Done CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TimeZone.Tests can break due to timezone aliases

3 participants