Skip to content

Commit

Permalink
feat(iota): add test for IotaCommand::Move (#3714)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M authored Oct 28, 2024
1 parent 07a5ef3 commit dfa89c5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/iota/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ shlex = "1.3.0"
iota-macros.workspace = true
iota-simulator.workspace = true
iota-test-transaction-builder.workspace = true
move-cli.workspace = true
test-cluster.workspace = true

[target.'cfg(msim)'.dependencies]
Expand Down
30 changes: 30 additions & 0 deletions crates/iota/tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4170,3 +4170,33 @@ async fn test_faucet() -> Result<(), anyhow::Error> {

Ok(())
}

#[sim_test]
async fn test_move_new() -> Result<(), anyhow::Error> {
let package_name = "test_move_new";
IotaCommand::Move {
package_path: None,
config: None,
build_config: move_package::BuildConfig::default(),
cmd: iota_move::Command::New(iota_move::new::New {
new: move_cli::base::new::New {
name: package_name.to_string(),
},
}),
}
.execute()
.await?;

// Get all the new file names
let files = read_dir(package_name)?
.flat_map(|r| r.map(|file| file.file_name().to_str().unwrap().to_owned()))
.collect::<Vec<_>>();

assert_eq!(3, files.len());
for name in ["sources", "tests", "Move.toml"] {
assert!(files.contains(&name.to_string()));
}

std::fs::remove_dir_all(package_name)?;
Ok(())
}

0 comments on commit dfa89c5

Please sign in to comment.