Skip to content

Commit 2e0fb03

Browse files
committed
Added pester tests
1 parent e28b206 commit 2e0fb03

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Describe "Find-MgGraphCommand Command" {
2+
BeforeAll {
3+
. (join-path $PSScriptRoot ..\custom\Find-MgGraphCommand.ps1)
4+
}
5+
Describe "BreakingChanges" {
6+
$CommandList = @()
7+
$Reports = @()
8+
$BreakingChangeReportV1Report = (Join-Path $PSScriptRoot "..\..\..\..\docs\PowerShellBreakingChanges-V1.0.csv")
9+
$BreakingChangeReportBetaReport = (Join-Path $PSScriptRoot "..\..\..\..\docs\PowerShellBreakingChanges-Beta.csv")
10+
$Reports += $BreakingChangeReportV1Report
11+
$Reports += $BreakingChangeReportBetaReport
12+
foreach ($BreakingChangeReport in $Reports) {
13+
Import-Csv $BreakingChangeReport |`
14+
ForEach-Object {
15+
$CommandTable = @{
16+
}
17+
$Command = $_."NewCmdlet"
18+
$Alias = $_."OldCmdlet"
19+
$CommandTable.Add("Command", $Command)
20+
$CommandTable.Add("Alias", $Alias)
21+
$CommandList += $CommandTable
22+
}
23+
It "Returns <Alias> (<Command>)" -ForEach $CommandList {
24+
$MgCommand = Find-MgGraphCommand -Command "$Command"
25+
$MgCommand[0].Command | Select-Object -Unique | Should -Be "$Command"
26+
$MgCommand[0].CommandAlias | Select-Object -Unique | Should -Be "$Alias"
27+
}
28+
}
29+
}
30+
31+
}

tools/PostGeneration/NewCommandMetadata.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ $ApiVersion | ForEach-Object {
7878
if (-not($Null -eq $CommandAliasValue)) {
7979
$CommandAliasValue = $CommandAliasValue.Replace("[global::System.Management.Automation.Alias(`"", "").Replace("`")", "").Replace("]", "")
8080
}
81+
if($CommandAliasValue -eq "RHV") {
82+
$CommandAliasValue = $null
83+
}
8184
$MappingValue = @{
8285
Command = $CommandName
8386
Variants = [System.Collections.ArrayList]@($VariantName)

0 commit comments

Comments
 (0)