Skip to content

Commit

Permalink
Cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Feb 5, 2024
1 parent 04ff2ea commit e94b177
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ mod tests {
let temp_dir = tempfile::tempdir().unwrap();
let project_dir = temp_dir.path().join(TEST_PROJECT_NAME);
let with_examples = vec![];
init(project_dir.as_path(), &"".to_owned(), &with_examples).unwrap();
init(project_dir.as_path(), &String::new(), &with_examples).unwrap();

assert_base_template_files_exist(&project_dir);
assert_default_hello_world_contract_files_exist(&project_dir);
Expand All @@ -362,7 +362,7 @@ mod tests {
let temp_dir = tempfile::tempdir().unwrap();
let project_dir = temp_dir.path().join(TEST_PROJECT_NAME);
let with_examples = ["alloc".to_owned()];
init(project_dir.as_path(), &"".to_owned(), &with_examples).unwrap();
init(project_dir.as_path(), &String::new(), &with_examples).unwrap();

assert_base_template_files_exist(&project_dir);
assert_default_hello_world_contract_files_exist(&project_dir);
Expand All @@ -385,7 +385,7 @@ mod tests {
let temp_dir = tempfile::tempdir().unwrap();
let project_dir = temp_dir.path().join("project");
let with_examples = ["account".to_owned(), "atomic_swap".to_owned()];
init(project_dir.as_path(), &"".to_owned(), &with_examples).unwrap();
init(project_dir.as_path(), &String::new(), &with_examples).unwrap();

assert_base_template_files_exist(&project_dir);
assert_default_hello_world_contract_files_exist(&project_dir);
Expand All @@ -409,7 +409,7 @@ mod tests {
let temp_dir = tempfile::tempdir().unwrap();
let project_dir = temp_dir.path().join("project");
let with_examples = ["invalid_example".to_owned(), "atomic_swap".to_owned()];
assert!(init(project_dir.as_path(), &"".to_owned(), &with_examples,).is_err());
assert!(init(project_dir.as_path(), &String::new(), &with_examples,).is_err());

temp_dir.close().unwrap();
}
Expand Down Expand Up @@ -513,10 +513,10 @@ mod tests {
fn assert_package_json_files_have_correct_name(project_dir: &Path) {
let package_json_path = project_dir.join("package.json");
let package_json_str = read_to_string(package_json_path).unwrap();
assert!(package_json_str.contains(&format!("\"name\":\"{}\"", TEST_PROJECT_NAME)));
assert!(package_json_str.contains(&format!("\"name\":\"{TEST_PROJECT_NAME}\"")));

let package_lock_json_path = project_dir.join("package-lock.json");
let package_lock_json_str = read_to_string(package_lock_json_path).unwrap();
assert!(package_lock_json_str.contains(&format!("\"name\":\"{}\"", TEST_PROJECT_NAME)));
assert!(package_lock_json_str.contains(&format!("\"name\":\"{TEST_PROJECT_NAME}\"")));
}
}

0 comments on commit e94b177

Please sign in to comment.