Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
chevdor committed Jun 21, 2022
commit d1ed2d3451b82e3f69a85a916f8c8f9f022188fe
5 changes: 4 additions & 1 deletion utils/staking-miner/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ mod test_super {
fn cli_info_works() {
let opt = Opt::try_parse_from([env!("CARGO_PKG_NAME"), "--uri", "hi", "info"]).unwrap();

assert_eq!(opt, Opt { uri: "hi".to_string(), command: Command::Info(InfoOpts {}) });
assert_eq!(
opt,
Opt { uri: "hi".to_string(), command: Command::Info(InfoOpts { json: true }) }
);
}

#[test]
Expand Down
7 changes: 5 additions & 2 deletions utils/staking-miner/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fn cli_info_works() {
let crate_name = env!("CARGO_PKG_NAME");
let output = Command::new(cargo_bin(crate_name))
.arg("info")
.arg("--json")
.env("RUST_LOG", "none")
.output()
.unwrap();
Expand All @@ -25,6 +26,8 @@ fn cli_info_works() {
let info = String::from_utf8_lossy(&output.stdout).trim().to_owned();
let v: Result<Value> = serde_json::from_str(&info);
let v = v.unwrap();
assert!(!v["spec_name"].to_string().is_empty());
assert!(!v["version"].to_string().is_empty());
assert!(!v["builtin"].to_string().is_empty());
assert!(!v["builtin"]["spec_name"].to_string().is_empty());
assert!(!v["builtin"]["spec_version"].to_string().is_empty());
assert!(!v["remote"].to_string().is_empty());
}