diff --git a/src/core/musichoard/database.rs b/src/core/musichoard/database.rs index 52b35b9..6f7c563 100644 --- a/src/core/musichoard/database.rs +++ b/src/core/musichoard/database.rs @@ -764,28 +764,22 @@ mod tests { database.expect_save().times(2).returning(|_| Ok(())); let mut music_hoard = MusicHoard::database(database).unwrap(); - assert_eq!( - music_hoard.collection[0].albums[0].meta.id.db_id, - AlbumDbId::None - ); + let album = &music_hoard.collection[0].albums[0]; + assert_eq!(album.meta.id.db_id, AlbumDbId::None); // Seting db_id on an album not belonging to the artist is an error. assert!(music_hoard .set_album_db_id(&artist_id, &album_id_2, AlbumDbId::CannotHaveMbid) .is_err()); - assert_eq!( - music_hoard.collection[0].albums[0].meta.id.db_id, - AlbumDbId::None - ); + let album = &music_hoard.collection[0].albums[0]; + assert_eq!(album.meta.id.db_id, AlbumDbId::None); // Set db_id. assert!(music_hoard .set_album_db_id(&artist_id, &album_id, AlbumDbId::CannotHaveMbid) .is_ok()); - assert_eq!( - music_hoard.collection[0].albums[0].meta.id.db_id, - AlbumDbId::CannotHaveMbid - ); + let album = &music_hoard.collection[0].albums[0]; + assert_eq!(album.meta.id.db_id, AlbumDbId::CannotHaveMbid); // Clearing db_id on an album that does not exist is an error. assert!(music_hoard @@ -797,18 +791,14 @@ mod tests { assert!(music_hoard .clear_album_db_id(&artist_id, &album_id) .is_err()); - assert_eq!( - music_hoard.collection[0].albums[0].meta.id.db_id, - AlbumDbId::CannotHaveMbid - ); + let album = &music_hoard.collection[0].albums[0]; + assert_eq!(album.meta.id.db_id, AlbumDbId::CannotHaveMbid); // To clear the db_id we need the album_id to have the db_id to identify the correct album. album_id.set_db_id(AlbumDbId::CannotHaveMbid); assert!(music_hoard.clear_album_db_id(&artist_id, &album_id).is_ok()); - assert_eq!( - music_hoard.collection[0].albums[0].meta.id.db_id, - AlbumDbId::None - ); + let album = &music_hoard.collection[0].albums[0]; + assert_eq!(album.meta.id.db_id, AlbumDbId::None); } #[test]