diff --git a/asyncgit/src/sync/branch.rs b/asyncgit/src/sync/branch.rs index 9fe530fb..24faf309 100644 --- a/asyncgit/src/sync/branch.rs +++ b/asyncgit/src/sync/branch.rs @@ -174,3 +174,43 @@ mod tests_create_branch { ); } } + +#[cfg(test)] +mod tests_branches { + use super::*; + use crate::sync::tests::repo_init; + + #[test] + fn test_smoke() { + let (_td, repo) = repo_init().unwrap(); + let root = repo.path().parent().unwrap(); + let repo_path = root.as_os_str().to_str().unwrap(); + + assert_eq!( + get_branches_to_display(repo_path) + .unwrap() + .iter() + .map(|b| b.name.clone()) + .collect::>(), + vec!["master"] + ); + } + + #[test] + fn test_multiple() { + let (_td, repo) = repo_init().unwrap(); + let root = repo.path().parent().unwrap(); + let repo_path = root.as_os_str().to_str().unwrap(); + + create_branch(repo_path, "test").unwrap(); + + assert_eq!( + get_branches_to_display(repo_path) + .unwrap() + .iter() + .map(|b| b.name.clone()) + .collect::>(), + vec!["master", "test"] + ); + } +}