Skip to content

Commit

Permalink
Fixed test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Helios-vmg authored and fpereira24 committed Dec 18, 2024
1 parent 2038709 commit 90e6851
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions apps/cargo-scout-audit/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::<serde_json::Value>(line))
.collect::<Vec<_>>();
assert!(
!scout_stdout.contains("[INFO]"),
"Output should not contain info prints",
);
let json_result: Result<serde_json::Value, _> =
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",
);
}

Expand All @@ -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::Value, _> =
serde_json::from_slice(&scout_output.stdout);
assert!(
Expand Down

0 comments on commit 90e6851

Please sign in to comment.