Skip to content

Commit

Permalink
Add a unit test asserting the init returns an error
Browse files Browse the repository at this point in the history
if the example contract is invalid
  • Loading branch information
elizabethengelman committed Jan 29, 2024
1 parent 59f659a commit 1110035
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,21 @@ mod tests {
temp_dir.close().unwrap();
}

#[test]
fn test_init_with_invalid_example_contract() {
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(),
&FrontendTemplate::None,
&with_examples,
)
.is_err());

temp_dir.close().unwrap();
}

#[test]
fn test_init_with_frontend_template() {
let temp_dir = tempfile::tempdir().unwrap();
Expand Down

0 comments on commit 1110035

Please sign in to comment.