Skip to content

Commit f5eb5bd

Browse files
committed
fix test
1 parent 0d76728 commit f5eb5bd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

sshdconfig/tests/defaultshell.tests.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,26 @@ Describe 'Default Shell Configuration Error Handling on Non-Windows Platforms' -
198198

199199
$out = sshdconfig set --input $inputConfig 2>&1
200200
$LASTEXITCODE | Should -Not -Be 0
201-
$out | Should -BeLike '*is only applicable to Windows*'
201+
$result = $out | ConvertFrom-Json
202+
$found = $false
203+
foreach ($item in $result) {
204+
if (($item.level -eq 'ERROR') -and ($item.fields.message -like '*is only applicable to Windows*')) {
205+
$found = $true
206+
}
207+
}
208+
$found | Should -Be $true
202209
}
203210

204211
It 'Should return error for get command' {
205212
$out = sshdconfig get -s windows-global 2>&1
206213
$LASTEXITCODE | Should -Not -Be 0
207-
$out | Should -BeLike '*is only applicable to Windows*'
214+
$result = $out | ConvertFrom-Json
215+
$found = $false
216+
foreach ($item in $result) {
217+
if (($item.level -eq 'ERROR') -and ($item.fields.message -like '*is only applicable to Windows*')) {
218+
$found = $true
219+
}
220+
}
221+
$found | Should -Be $true
208222
}
209223
}

0 commit comments

Comments
 (0)