2
2
# Licensed under the MIT License.
3
3
4
4
Describe ' Configruation variables tests' {
5
- It ' Variables example config works' {
6
- $configFile = " $PSSCriptRoot /../examples/variables.dsc.yaml"
7
- $out = dsc config get -f $configFile | ConvertFrom-Json
8
- $LASTEXITCODE | Should - Be 0
9
- $out.results [0 ].result.actualState.output | Should - BeExactly ' myOutput is: Hello world!, myObject is: baz'
10
- }
5
+ It ' Variables example config works' {
6
+ $configFile = " $PSSCriptRoot /../examples/variables.dsc.yaml"
7
+ $out = dsc config get -f $configFile | ConvertFrom-Json
8
+ $LASTEXITCODE | Should - Be 0
9
+ $out.results [0 ].result.actualState.output | Should - BeExactly ' myOutput is: Hello world!, myObject is: baz'
10
+ }
11
11
12
- It ' Duplicated variable takes last value' {
13
- $configYaml = @'
12
+ It ' Duplicated variable takes last value' {
13
+ $configYaml = @'
14
14
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
15
15
variables:
16
16
myVariable: foo
@@ -21,14 +21,14 @@ resources:
21
21
properties:
22
22
output: "[variables('myVariable')]"
23
23
'@
24
- $out = dsc config get - i $configYaml | ConvertFrom-Json
25
- Write-Verbose - Verbose $out
26
- $LASTEXITCODE | Should - Be 0
27
- $out.results [0 ].result.actualState.output | Should - Be ' bar'
28
- }
24
+ $out = dsc config get - i $configYaml | ConvertFrom-Json
25
+ Write-Verbose - Verbose $out
26
+ $LASTEXITCODE | Should - Be 0
27
+ $out.results [0 ].result.actualState.output | Should - Be ' bar'
28
+ }
29
29
30
- It ' Missing variable returns error' {
31
- $configYaml = @'
30
+ It ' Missing variable returns error' {
31
+ $configYaml = @'
32
32
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
33
33
variables:
34
34
hello: world
@@ -38,9 +38,9 @@ resources:
38
38
properties:
39
39
output: "[variables('myVariable')]"
40
40
'@
41
- $out = dsc config get - i $configYaml 2>&1 | Out-String
42
- Write-Verbose - Verbose $out
43
- $LASTEXITCODE | Should - Be 2
44
- $out | Should - BeLike " *Variable 'myVariable' does not exist or has not been initialized yet*"
45
- }
41
+ $out = dsc config get - i $configYaml 2>&1 | Out-String
42
+ Write-Verbose - Verbose $out
43
+ $LASTEXITCODE | Should - Be 2
44
+ $out | Should - BeLike " *Variable 'myVariable' does not exist or has not been initialized yet*"
45
+ }
46
46
}
0 commit comments