From 90e685177da5cc232f2558d09b03537e97361f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20M=2E=20Gonz=C3=A1lez?= Date: Tue, 17 Dec 2024 15:12:15 -0300 Subject: [PATCH] Fixed test. --- apps/cargo-scout-audit/tests/main.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/apps/cargo-scout-audit/tests/main.rs b/apps/cargo-scout-audit/tests/main.rs index e381cce8..cee05cee 100644 --- a/apps/cargo-scout-audit/tests/main.rs +++ b/apps/cargo-scout-audit/tests/main.rs @@ -3,7 +3,6 @@ mod tests { use anyhow::Result; use cargo_scout_audit::{ cli::{OutputFormat, Scout}, - scout::findings::output_to_json, startup::run_scout, }; use lazy_static::lazy_static; @@ -277,17 +276,14 @@ mod tests { .output() .unwrap(); - let scout_stdout = std::str::from_utf8(&scout_output.stdout).unwrap(); + let output = std::str::from_utf8(&scout_output.stdout).unwrap(); + let output = output + .lines() + .map(|line| serde_json::from_str::(line)) + .collect::>(); assert!( - !scout_stdout.contains("[INFO]"), - "Output should not contain info prints", - ); - let json_result: Result = - serde_json::from_slice(&scout_output.stdout); - assert!( - json_result.is_ok(), - "Output should be valid JSON, got: {:?}", - scout_stdout + output.iter().all(|x| x.is_ok()), + "Output should be valid JSON", ); } @@ -301,10 +297,6 @@ mod tests { .output() .unwrap(); let scout_stdout = std::str::from_utf8(&scout_output.stdout).unwrap(); - assert!( - !scout_stdout.contains("[INFO]"), - "Output should not contain info prints", - ); let json_result: Result = serde_json::from_slice(&scout_output.stdout); assert!(