From a7898d28861e301fb0d622903b7a044b7c9a82d4 Mon Sep 17 00:00:00 2001 From: "James Truher [MSFT]" Date: Thu, 20 Apr 2023 16:14:09 -0700 Subject: [PATCH] Harden 'All approved Cmdlets present' test (#19530) --- test/powershell/engine/Basic/DefaultCommands.Tests.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index 9d1b030a6a..27be013ec6 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -1,6 +1,6 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -Describe "Verify approved aliases list" -Tags "CI" { +Describe "Verify aliases and cmdlets" -Tags "CI" { BeforeAll { function ConvertTo-Hashtable { [CmdletBinding()] @@ -612,9 +612,9 @@ Describe "Verify approved aliases list" -Tags "CI" { } It "All approved Cmdlets present (no new Cmdlets added, no Cmdlets removed)" { - $expectedCmdletList = $commandList.Where({$_.Present -eq "True" -and $_.CommandType -eq "Cmdlet"}).Name | Sort-Object - $observedCmdletList = $currentCmdletList.Name | Sort-Object - $observedCmdletList | Should -Be $expectedCmdletList + $observedCmdletNames = $currentCmdletList.ForEach({"{0}" -f $_.Name}) | Sort-Object + $expectedCmdletNames = $commandHashTableList.ForEach({"{0}" -f $_.Name}) | Sort-Object + $observedCmdletNames | Should -Be $expectedCmdletNames } It "'' Cmdlet should have the correct ConfirmImpact ''" -TestCases $commandHashtableList {