From fa6ba24f5191eefa2415027963813d25f81ac2e7 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 14 Jan 2025 20:13:49 -0800 Subject: [PATCH] removed json check in tests --- dsc/tests/dsc_config_get.tests.ps1 | 12 +++++------- dsc/tests/dsc_resource_list.tests.ps1 | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/dsc/tests/dsc_config_get.tests.ps1 b/dsc/tests/dsc_config_get.tests.ps1 index a88ff256..603dd862 100644 --- a/dsc/tests/dsc_config_get.tests.ps1 +++ b/dsc/tests/dsc_config_get.tests.ps1 @@ -65,17 +65,15 @@ Describe 'dsc config get tests' { properties: output: hello "@ - $config_yaml | dsc config get --output-format json -f - 2> $TestDrive/ErrorStream.txt + $config_yaml | dsc -t json config get --output-format json -f - 2> $TestDrive/ErrorStream.txt $LASTEXITCODE | Should -Be 0 $lines = Get-Content $TestDrive/ErrorStream.txt $ProgressMessagesFound = $False foreach ($line in $lines) { - if ($line.StartsWith('{')) { - $jp = $line | ConvertFrom-Json - if ($jp.activity) { # if line is a progress message - $jp.percent_complete | Should -BeIn (0..100) - $ProgressMessagesFound = $True - } + $jp = $line | ConvertFrom-Json + if ($jp.activity) { # if line is a progress message + $jp.percent_complete | Should -BeIn (0..100) + $ProgressMessagesFound = $True } } $ProgressMessagesFound | Should -BeTrue diff --git a/dsc/tests/dsc_resource_list.tests.ps1 b/dsc/tests/dsc_resource_list.tests.ps1 index fcfa989d..aa94bdfe 100644 --- a/dsc/tests/dsc_resource_list.tests.ps1 +++ b/dsc/tests/dsc_resource_list.tests.ps1 @@ -59,17 +59,15 @@ Describe 'Tests for listing resources' { } It 'json progress for resource subcommand' { - dsc resource list -o json -a '*' 2> $TestDrive/ErrorStream.txt + dsc -t json resource list -o json -a '*' 2> $TestDrive/ErrorStream.txt $LASTEXITCODE | Should -Be 0 $lines = Get-Content $TestDrive/ErrorStream.txt $ProgressMessagesFound = $False foreach ($line in $lines) { - if ($line.StartsWith('{')) { - $jp = $line | ConvertFrom-Json - if ($jp.activity) { # if line is a progress message - $jp.percent_complete | Should -BeIn (0..100) - $ProgressMessagesFound = $True - } + $jp = $line | ConvertFrom-Json + if ($jp.activity) { # if line is a progress message + $jp.percent_complete | Should -BeIn (0..100) + $ProgressMessagesFound = $True } } $ProgressMessagesFound | Should -BeTrue