diff --git a/src/database/json/mod.rs b/src/database/json/mod.rs index a1fd666..dbed862 100644 --- a/src/database/json/mod.rs +++ b/src/database/json/mod.rs @@ -67,7 +67,7 @@ mod tests { use super::*; - use crate::{tests::COLLECTION, Artist, ArtistId, Format}; + use crate::{tests::COLLECTION, Artist, ArtistId, Format, Collection}; fn artist_to_json(artist: &Artist) -> String { let album_artist = &artist.id.name; @@ -186,7 +186,18 @@ mod tests { } #[test] - fn errors() { + fn load_errors() { + let json = String::from(""); + let serde_err = serde_json::from_str::(&json); + assert!(serde_err.is_err()); + + let serde_err: LoadError = serde_err.unwrap_err().into(); + assert!(!serde_err.to_string().is_empty()); + assert!(!format!("{:?}", serde_err).is_empty()); + } + + #[test] + fn save_errors() { let mut object = HashMap::::new(); object.insert( ArtistId {