Skip to content

Commit

Permalink
finish first arg parse test
Browse files Browse the repository at this point in the history
  • Loading branch information
zancas committed Jan 12, 2024
1 parent 4cdd892 commit e3db3d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion zingocli/tests/argument_parsing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#[test]
fn clargs_view_key_birthday_fresh_wallet_dir() {
let expected_output: &str = r#"{
"ufvk": "uview1ah2qw247djujxwu5tdr20t7naaqvd5qkljxtm0yrw92tzy6fvafdhv7uchvsrzxaqskc7mxphzafgn5aca6pscrdx8xqu95ruyefng0hcctsnle4jq9f97gvymlf78pal7zqwf3yfej6han20pvhj0j0ew05dzq685kx29phyy5ffuw63wxmvesm9r23jhccfrdm9yxr5tz4hkw40t0ak5j4lgr67zdcl9rhluaqwatudjhaq0lep5ffcc8yrruvf0tz9zmxl5zfg9lx728mwdz4705wsr9fr8h4u7nc5ja8c560j45jn0jqty8hcqjedjakjkj04najmvzk4fr0g9kevshe6verg8h9pr4phx86wsc2xa5rdp78zrr5upuyqanhk98w4u3vs9mssdnxrwe9xf4qlffqq46faaxuvnsst4mn87eyk4j6h4jm6t3kzcmwh0waw8u5500yqyfm35ndcerzkx8xr5xaznqrma0zy69qvgz7nnyq",
"birthday": 2363649
}
"#;
// Remove the 'foo' directory if it exists
let cli_parse_test_data = "./cli_parse_test_data";
let cpdp = std::path::Path::new(cli_parse_test_data);
Expand All @@ -15,7 +20,7 @@ fn clargs_view_key_birthday_fresh_wallet_dir() {
.args(&["--birthday", "2363649"])
.args(&["--fresh-wallet-dir", cli_parse_test_data])
.args(&["--nosync"])
.args(&["info"])
.args(&["exportufvk"])
.output()
.expect("Failed to execute cargo run command");

Expand All @@ -25,6 +30,10 @@ fn clargs_view_key_birthday_fresh_wallet_dir() {
// Additional assertions based on the expected behavior of your application
// For example, check if the 'foo' directory was created
assert!(std::fs::metadata(cpdp).is_ok());
assert_eq!(
std::string::String::from_utf8_lossy(&output.stdout),
expected_output
);
if std::fs::metadata(cli_parse_test_data).is_ok() {
std::fs::remove_dir_all(cli_parse_test_data)
.expect("Failed to remove existing foo directory");
Expand Down

0 comments on commit e3db3d2

Please sign in to comment.