@@ -23,34 +23,28 @@ Describe 'Discover extension tests' {
23
23
It ' Discover extensions' {
24
24
$out = dsc extension list | ConvertFrom-Json
25
25
$LASTEXITCODE | Should - Be 0
26
- if ($IsWindows ) {
27
- $out.Count | Should - Be 4 - Because ($out | Out-String )
28
- $out [0 ].type | Should - Be ' Microsoft.DSC.Extension/Bicep'
29
- $out [0 ].version | Should - Be ' 0.1.0'
30
- $out [0 ].capabilities | Should - BeExactly @ (' import' )
31
- $out [0 ].manifest | Should -Not - BeNullOrEmpty
32
- $out [1 ].type | Should - Be ' Microsoft.DSC.Extension/WindowsPowerShell'
33
- $out [1 ].version | Should - Be ' 0.1.0'
34
- $out [1 ].capabilities | Should - BeExactly @ (' import' )
35
- $out [1 ].manifest | Should -Not - BeNullOrEmpty
36
- $out [2 ].type | Should - Be ' Microsoft.Windows.Appx/Discover'
37
- $out [2 ].version | Should - Be ' 0.1.0'
38
- $out [2 ].capabilities | Should - BeExactly @ (' discover' )
39
- $out [2 ].manifest | Should -Not - BeNullOrEmpty
40
- $out [3 ].type | Should - BeExactly ' Test/Discover'
41
- $out [3 ].version | Should - BeExactly ' 0.1.0'
42
- $out [3 ].capabilities | Should - BeExactly @ (' discover' )
43
- $out [3 ].manifest | Should -Not - BeNullOrEmpty
26
+ $expectedExtensions = if ($IsWindows ) {
27
+ @ (
28
+ @ { type = ' Microsoft.DSC.Extension/Bicep' ; version = ' 0.1.0' ; capabilities = @ (' import' ) }
29
+ @ { type = ' Microsoft.DSC.Transitional/PSDesiredStateConfiguration' ; version = ' 0.1.0' ; capabilities = @ (' import' ) }
30
+ @ { type = ' Microsoft.Windows.Appx/Discover' ; version = ' 0.1.0' ; capabilities = @ (' discover' ) }
31
+ @ { type = ' Test/Discover' ; version = ' 0.1.0' ; capabilities = @ (' discover' ) }
32
+ )
44
33
} else {
45
- $out.Count | Should - Be 2 - Because ($out | Out-String )
46
- $out [0 ].type | Should - Be ' Microsoft.DSC.Extension/Bicep'
47
- $out [0 ].version | Should - Be ' 0.1.0'
48
- $out [0 ].capabilities | Should - BeExactly @ (' import' )
49
- $out [0 ].manifest | Should -Not - BeNullOrEmpty
50
- $out [1 ].type | Should - BeExactly ' Test/Discover'
51
- $out [1 ].version | Should - BeExactly ' 0.1.0'
52
- $out [1 ].capabilities | Should - BeExactly @ (' discover' )
53
- $out [1 ].manifest | Should -Not - BeNullOrEmpty
34
+ @ (
35
+ @ { type = ' Microsoft.DSC.Extension/Bicep' ; version = ' 0.1.0' ; capabilities = @ (' import' ) }
36
+ @ { type = ' Test/Discover' ; version = ' 0.1.0' ; capabilities = @ (' discover' ) }
37
+ )
38
+ }
39
+
40
+ $out.Count | Should - Be $expectedExtensions.Count - Because ($out | Out-String )
41
+
42
+ foreach ($expected in $expectedExtensions ) {
43
+ $extension = $out | Where-Object { $_.type -eq $expected.type }
44
+ $extension | Should -Not - BeNullOrEmpty - Because " Extension $ ( $expected.type ) should exist"
45
+ $extension.version | Should - BeExactly $expected.version
46
+ $extension.capabilities | Should - BeExactly $expected.capabilities
47
+ $extension.manifest | Should -Not - BeNullOrEmpty
54
48
}
55
49
}
56
50
0 commit comments