From adee7d31b7baaebb7515ff09e87d99a8a34f6fa8 Mon Sep 17 00:00:00 2001 From: Alessandro Menezes Date: Tue, 11 Oct 2022 17:35:33 -0400 Subject: [PATCH] Improve code coverage of src/info/repo/contributors.rs (#814) --- src/info/repo/contributors.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/info/repo/contributors.rs b/src/info/repo/contributors.rs index 9d9234b07..00243137f 100644 --- a/src/info/repo/contributors.rs +++ b/src/info/repo/contributors.rs @@ -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]