Skip to content

Commit

Permalink
Improve code coverage of src/info/repo/contributors.rs (o2sh#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroasm authored Oct 11, 2022
1 parent 4c615ab commit adee7d3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/info/repo/contributors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,22 @@ mod test {

#[test]
fn test_display_contributors_info() {
let contributors_info = ContributorsInfo {
number_of_contributors: 12,
number_of_authors_to_display: 2,
use crate::info::git::Commits;
use git_repository::actor::Time;

let timestamp = Time::now_utc();
let commits = Commits {
authors: vec![],
total_num_authors: 12,
num_commits: 2,
is_shallow: true,
time_of_most_recent_commit: timestamp,
time_of_first_commit: timestamp,
};

let contributors_info = ContributorsInfo::new(&commits, 2);
assert_eq!(contributors_info.value(), "12".to_string());
assert_eq!(contributors_info.title(), "Contributors".to_string());
}

#[test]
Expand Down

0 comments on commit adee7d3

Please sign in to comment.