Fix code coverage
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m2s
Cargo CI / Lint (pull_request) Successful in 43s

This commit is contained in:
Wojciech Kozlowski 2024-01-12 20:38:42 +01:00
parent 6a6d9f33ad
commit 9c126461fc

View File

@ -1111,7 +1111,7 @@ mod tests {
fn artist_new_delete() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
let mut expected: Vec<Artist> = vec![];
@ -1133,7 +1133,7 @@ mod tests {
#[test]
fn collection_error() {
let artist_id = ArtistId::new("an artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
let actual_err = music_hoard
.add_musicbrainz_url(&artist_id, QOBUZ)
@ -1148,7 +1148,7 @@ mod tests {
fn add_remove_musicbrainz_url() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1219,7 +1219,7 @@ mod tests {
fn set_clear_musicbrainz_url() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1274,7 +1274,7 @@ mod tests {
fn add_remove_musicbutler_urls() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1404,7 +1404,7 @@ mod tests {
fn set_clear_musicbutler_urls() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1467,7 +1467,7 @@ mod tests {
fn add_remove_bandcamp_urls() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1597,7 +1597,7 @@ mod tests {
fn set_clear_bandcamp_urls() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1660,7 +1660,7 @@ mod tests {
fn add_remove_qobuz_url() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1711,7 +1711,7 @@ mod tests {
fn set_clear_qobuz_url() {
let artist_id = ArtistId::new("an artist");
let artist_id_2 = ArtistId::new("another artist");
let mut music_hoard = MusicHoardBuilder::new().build();
let mut music_hoard = MusicHoardBuilder::default().build();
music_hoard.add_artist(artist_id.clone());
@ -1850,7 +1850,7 @@ mod tests {
let mut expected = COLLECTION.to_owned();
expected.sort_unstable();
let merged = MusicHoard::<MockILibrary, MockIDatabase>::merge(left.clone(), right);
let merged = MusicHoard::<NoLibrary, NoDatabase>::merge(left.clone(), right);
assert_eq!(expected, merged);
}
@ -1864,7 +1864,7 @@ mod tests {
let mut expected = COLLECTION.to_owned();
expected.sort_unstable();
let merged = MusicHoard::<MockILibrary, MockIDatabase>::merge(left.clone(), right);
let merged = MusicHoard::<NoLibrary, NoDatabase>::merge(left.clone(), right);
assert_eq!(expected, merged);
}
@ -1882,7 +1882,10 @@ mod tests {
.times(1)
.return_once(|_| library_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
music_hoard.rescan_library().unwrap();
assert_eq!(
@ -1909,7 +1912,10 @@ mod tests {
.times(1)
.return_once(|_| library_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
music_hoard.rescan_library().unwrap();
assert_eq!(
@ -1936,7 +1942,10 @@ mod tests {
.times(1)
.return_once(|_| library_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
music_hoard.rescan_library().unwrap();
assert_eq!(music_hoard.get_collection(), &expected);
@ -1955,7 +1964,10 @@ mod tests {
Ok(())
});
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
music_hoard.load_from_database().unwrap();
assert_eq!(music_hoard.get_collection(), &*COLLECTION);
@ -1984,7 +1996,10 @@ mod tests {
.times(1)
.return_once(|_: &Collection| database_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
music_hoard.rescan_library().unwrap();
assert_eq!(
@ -2006,7 +2021,10 @@ mod tests {
.times(1)
.return_once(|_| library_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
let actual_err = music_hoard.rescan_library().unwrap_err();
let expected_err =
@ -2028,7 +2046,10 @@ mod tests {
.times(1)
.return_once(|_: &mut Collection| database_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
let actual_err = music_hoard.load_from_database().unwrap_err();
let expected_err = Error::DatabaseError(
@ -2051,7 +2072,10 @@ mod tests {
.times(1)
.return_once(|_: &Collection| database_result);
let mut music_hoard = MusicHoard::new(library, database);
let mut music_hoard = MusicHoardBuilder::default()
.set_library(library)
.set_database(database)
.build();
let actual_err = music_hoard.save_to_database().unwrap_err();
let expected_err = Error::DatabaseError(