You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It '[<moduleFolderName>] If template has a parameter [<parameterName>], it should implement the user-defined type [<udtName>]'-TestCases $udtTestCases {
706
+
It '[<moduleFolderName>] If template has a parameter [<parameterName>], it should implement AVM''s corresponding user-defined type.'-TestCases $udtTestCases {
716
707
717
708
param(
718
709
[hashtable] $templateFileContent,
719
710
[string[]] $templateFileContentBicep,
720
711
[string] $parameterName,
721
-
[string] $udtName,
722
-
[string] $expectedUdtUrl,
723
712
[string] $link
724
713
)
725
714
726
715
if ($templateFileContent.parameters.Keys-contains$parameterName) {
727
-
$templateFileContent.parameters.$parameterName.Keys| Should -Contain '$ref'-Because "the [$parameterName] parameter should use a user-defined type. For information please review the [AVM Specs]($link)."
728
-
$templateFileContent.parameters.$parameterName.'$ref'| Should -Be "#/definitions/$udtName"-Because "the [$parameterName] parameter should use a user-defined type [$udtName]. For information please review the [AVM Specs]($link)."
729
-
730
-
if (-not [String]::IsNullOrEmpty($expectedUdtUrl)) {
$warningMessage="The implemented user-defined type is not the same as the expected user-defined type ({0}) defined in the AVM specs ({1}) and should not have diff`n{2}"-f$expectedUdtUrl,$link, ($formattedDiff|Out-String)
$mdFormattedWarningMessage='The implemented user-defined type is not the same as the expected [user-defined type]({0}) defined in the [AVM specs]({1}) and should not have diff</br><pre>{2}</pre>'-f$expectedUdtUrl,$link,$mdFormattedDiff
784
-
Write-Output@{
785
-
Warning=$mdFormattedWarningMessage
786
-
}
787
-
}
717
+
if ($templateFileContent.parameters.$parameterName.Keys-contains'items') {
718
+
# If parameter is an array, the UDT may focus on each element
719
+
$templateFileContent.parameters.$parameterName.items.Keys| Should -Contain '$ref'-Because "the [$parameterName] parameter should use a user-defined type. For information please review the [AVM Specs]($link)."
720
+
} else {
721
+
# If not, the parameter itself should reference a UDT
722
+
$templateFileContent.parameters.$parameterName.Keys| Should -Contain '$ref'-Because "the [$parameterName] parameter should use a user-defined type. For information please review the [AVM Specs]($link)."
788
723
}
789
724
} else {
790
725
Set-ItResult-Skipped -Because "the module template has no [$parameterName] parameter."
0 commit comments