@@ -56,7 +56,7 @@ Describe 'PowerShell adapter resource tests' {
56
56
}
57
57
58
58
59
- <# It 'Export works on config with class-based resources' -Skip:(!$IsWindows){
59
+ It ' Export works on config with class-based resources' - Skip:(! $IsWindows ){
60
60
61
61
$yaml = @'
62
62
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/config/document.json
@@ -66,51 +66,47 @@ Describe 'PowerShell adapter resource tests' {
66
66
properties:
67
67
resources:
68
68
- name: Class-resource Info
69
- type: PSTestModule /TestClassResource
69
+ type: TestClassResource /TestClassResource
70
70
'@
71
71
$out = $yaml | dsc config export
72
72
$LASTEXITCODE | Should - Be 0
73
73
$res = $out | ConvertFrom-Json
74
74
$res .' $schema' | Should - BeExactly ' https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json'
75
75
$res .' resources' | Should -Not - BeNullOrEmpty
76
- $res.resources.count | Should -Be 5
77
- $res.resources[0].properties.Name | Should -Be "Object1"
78
- $res.resources[0].properties.Prop1 | Should -Be "Property of object1"
76
+ $res.resources [ 0 ].properties.result .count | Should - Be 5
77
+ $res.resources [0 ].properties.result[ 0 ]. Name | Should - Be " Object1"
78
+ $res.resources [0 ].properties.result[ 0 ]. Prop1 | Should - Be " Property of object1"
79
79
}
80
80
81
- #>
82
-
83
81
It ' Custom psmodulepath in config works' - Skip:(! $IsWindows ){
84
82
85
83
$OldPSModulePath = $env: PSModulePath
86
- Copy-Item - Recurse - Force - Path " $PSScriptRoot /PSTestModule " - Destination $TestDrive
87
- Rename-Item - Path " $PSScriptRoot /PSTestModule " - NewName " _PSTestModule "
84
+ Copy-Item - Recurse - Force - Path " $PSScriptRoot /TestClassResource " - Destination $TestDrive
85
+ Rename-Item - Path " $PSScriptRoot /TestClassResource " - NewName " _TestClassResource "
88
86
89
87
try {
90
88
$yaml = @"
91
- `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/config/document.json
89
+ `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/config/document.json
90
+ resources:
91
+ - name: Working with class-based resources
92
+ type: Microsoft.DSC/PowerShell
93
+ properties:
94
+ psmodulepath: `$ env:PSModulePath;$TestDrive
92
95
resources:
93
- - name: Working with class-based resources
94
- type: Microsoft.DSC/PowerShell
95
- properties:
96
- psmodulepath: `$ env:PSModulePath;$TestDrive
97
- resources:
98
- - name: Class-resource Info
99
- type: PSTestModule/TestClassResource
96
+ - name: Class-resource Info
97
+ type: TestClassResource/TestClassResource
100
98
"@
101
- <#
102
99
$out = $yaml | dsc config export
103
100
$LASTEXITCODE | Should - Be 0
104
101
$res = $out | ConvertFrom-Json
105
102
$res .' $schema' | Should - BeExactly ' https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json'
106
103
$res .' resources' | Should -Not - BeNullOrEmpty
107
- $res.resources.count | Should -Be 5
108
- $res.resources[0].properties.Name | Should -Be "Object1"
109
- $res.resources[0].properties.Prop1 | Should -Be "Property of object1"
110
- #>
104
+ $res.resources [0 ].properties.result.count | Should - Be 5
105
+ $res.resources [0 ].properties.result[0 ].Name | Should - Be " Object1"
106
+ $res.resources [0 ].properties.result[0 ].Prop1 | Should - Be " Property of object1"
111
107
}
112
108
finally {
113
- Rename-Item - Path " $PSScriptRoot /_PSTestModule " - NewName " PSTestModule "
109
+ Rename-Item - Path " $PSScriptRoot /_TestClassResource " - NewName " TestClassResource "
114
110
$env: PSModulePath = $OldPSModulePath
115
111
}
116
112
}
0 commit comments