Skip to content

Commit b5defea

Browse files
committed
Fix up tests
1 parent 72db174 commit b5defea

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

dsc/tests/dsc_parameters.tests.ps1

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -590,15 +590,16 @@ Describe 'Parameters tests' {
590590
$value = "'$value'"
591591
}
592592

593+
$minConstraint = if ($type -eq 'string') { "minLength: $min" } else { "minValue: $min" }
594+
$maxConstraint = if ($type -eq 'string') { "maxLength: $max" } else { "maxValue: $max" }
595+
593596
$config_yaml = @"
594597
`$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
595598
parameters:
596599
param1:
597600
type: $type
598-
minLength: $min
599-
maxLength: $max
600-
minValue: $min
601-
maxValue: $max
601+
$minConstraint
602+
$maxConstraint
602603
defaultValue: $value
603604
resources:
604605
- name: Echo
@@ -651,19 +652,16 @@ Describe 'Parameters tests' {
651652
) {
652653
param($type, $value, $min, $max)
653654

654-
if ($type -eq 'string') {
655-
$value = "'$value'"
656-
}
655+
$minConstraint = if ($type -eq 'string') { "minLength: $min" } else { "minValue: $min" }
656+
$maxConstraint = if ($type -eq 'string') { "maxLength: $max" } else { "maxValue: $max" }
657657

658658
$config_yaml = @"
659659
`$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
660660
parameters:
661661
param1:
662662
type: $type
663-
minLength: $min
664-
maxLength: $max
665-
minValue: $min
666-
maxValue: $max
663+
$minConstraint
664+
$maxConstraint
667665
defaultValue: $value
668666
resources:
669667
- name: Echo
@@ -685,10 +683,6 @@ Describe 'Parameters tests' {
685683
) {
686684
param($type, $value, $allowed)
687685

688-
if ($type -eq 'string') {
689-
$value = "'$value'"
690-
}
691-
692686
$config_yaml = @"
693687
`$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
694688
parameters:

0 commit comments

Comments
 (0)