This commit is contained in:
Ajinkya Kulkarni 2025-02-25 14:34:56 +01:00
parent e6abeb5ba7
commit 8d87786f84

View file

@ -72,9 +72,9 @@ impl CliClient {
let output = command.output().expect("command output failed").stdout; let output = command.output().expect("command output failed").stdout;
let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string(); let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string();
let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON"); let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON");
assert_eq!(json["price"]["amount"].to_string(), "0.005300000000000000"); let amount = strip_dquotes(json["price"]["amount"].to_string()));
let price = &json["price"]["amount"].as_f64().expect("couldn't parse gas price"); let price = amount.as_f64().expect("couldn't parse gas price");
let gas_price = format!("{}untrn", price); let gas_price = format!("{}untrn", price);
@ -305,6 +305,6 @@ mod tests {
let output = command.output().expect("command output failed").stdout; let output = command.output().expect("command output failed").stdout;
let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string(); let output_str: String = std::str::from_utf8(&output).expect("unable to parse command output").to_string();
let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON"); let json: Value = serde_json::from_str(&output_str).expect("could not convert to JSON");
assert_eq!(json["price"]["amount"].to_string(), "0.005300000000000000"); assert_eq!(strip_dquotes(json["price"]["amount"].to_string()), "0.005300000000000000");
} }
} }