forked from o2sh/onefetch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: gallottino <[email protected]> Co-authored-by: Oniryu95 <[email protected]>
- Loading branch information
1 parent
cc7a59c
commit 7866c28
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,4 +135,97 @@ mod test { | |
|
||
assert_eq!(author.to_string(), "75% John Doe 1500"); | ||
} | ||
|
||
#[test] | ||
fn test_authors_info_title_with_one_author() { | ||
let author = Author::new( | ||
"John Doe".into(), | ||
"[email protected]".into(), | ||
1500, | ||
2000, | ||
true, | ||
); | ||
|
||
let authors_info = AuthorsInfo { | ||
info_color: DynColors::Rgb(255, 0, 0), | ||
authors: vec![author], | ||
}; | ||
|
||
assert_eq!(authors_info.title(), "Author"); | ||
} | ||
|
||
#[test] | ||
fn test_authors_info_title_with_two_authors() { | ||
let author = Author::new( | ||
"John Doe".into(), | ||
"[email protected]".into(), | ||
1500, | ||
2000, | ||
true, | ||
); | ||
|
||
let author_2 = Author::new( | ||
"Roberto Berto".into(), | ||
"[email protected]".into(), | ||
240, | ||
300, | ||
false, | ||
); | ||
|
||
let authors_info = AuthorsInfo { | ||
info_color: DynColors::Rgb(255, 0, 0), | ||
authors: vec![author, author_2], | ||
}; | ||
|
||
assert_eq!(authors_info.title(), "Authors"); | ||
} | ||
|
||
#[test] | ||
fn test_author_info_value_with_one_author() { | ||
let author = Author::new( | ||
"John Doe".into(), | ||
"[email protected]".into(), | ||
1500, | ||
2000, | ||
true, | ||
); | ||
|
||
let authors_info = AuthorsInfo { | ||
info_color: DynColors::Rgb(255, 0, 0), | ||
authors: vec![author.clone()], | ||
}; | ||
|
||
assert!(authors_info | ||
.value() | ||
.contains("75% John Doe <[email protected]> 1500")); | ||
} | ||
|
||
#[test] | ||
fn test_author_info_value_with_two_author() { | ||
let author = Author::new( | ||
"John Doe".into(), | ||
"[email protected]".into(), | ||
1500, | ||
2000, | ||
true, | ||
); | ||
|
||
let author_2 = Author::new( | ||
"Roberto Berto".into(), | ||
"[email protected]".into(), | ||
240, | ||
300, | ||
false, | ||
); | ||
|
||
let authors_info = AuthorsInfo { | ||
info_color: DynColors::Rgb(255, 0, 0), | ||
authors: vec![author, author_2], | ||
}; | ||
|
||
assert!(authors_info | ||
.value() | ||
.contains("75% John Doe <[email protected]> 1500")); | ||
assert!(authors_info.value().contains("80% Roberto Berto 240")); | ||
} | ||
} |