From da1cb61c9147631c9a2ba6598e3105132b41c2c3 Mon Sep 17 00:00:00 2001 From: Garrett Squire Date: Tue, 8 Oct 2024 17:07:21 -0700 Subject: [PATCH] test(repo): expand unit tests of the repo module (#909) --- git-cliff-core/src/repo.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/git-cliff-core/src/repo.rs b/git-cliff-core/src/repo.rs index 143809831f..170ab1b413 100644 --- a/git-cliff-core/src/repo.rs +++ b/git-cliff-core/src/repo.rs @@ -512,11 +512,24 @@ mod test { Ok(()) } + #[test] + fn commit_search() -> Result<()> { + let repository = get_repository()?; + assert!(repository + .find_commit("e936ed571533ea6c41a1dd2b1a29d085c8dbada5") + .is_some()); + Ok(()) + } + #[test] fn get_latest_tag() -> Result<()> { let repository = get_repository()?; let tags = repository.tags(&None, false, false)?; - assert_eq!(get_last_tag()?, tags.last().expect("no tags found").1.name); + let latest = tags.last().expect("no tags found").1.name.clone(); + assert_eq!(get_last_tag()?, latest); + + let current = repository.current_tag().expect("a current tag").name; + assert!(current.contains(&latest)); Ok(()) }