Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(repo): expand unit tests of the repo module #909

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion git-cliff-core/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down
Loading