diff --git a/src/coverart.rs b/src/coverart.rs index ebbf013..8f55f24 100644 --- a/src/coverart.rs +++ b/src/coverart.rs @@ -10,6 +10,32 @@ pub struct CoverArt { pub data: Vec, } +pub mod init { + use crate::coverart::CoverArt; + + pub fn init_coverart_only_path(path: &String) -> CoverArt { + CoverArt { + id: uuid::Uuid::new_v4(), + title: String::new(), + path: path.clone(), + data: Vec::new(), + } + } +} + +#[cfg(test)] +mod tests { + use crate::coverart; + + #[test] + fn test_cover_art_image() { + let path: String = String::from("somepath"); + let coverart = coverart::init::init_coverart_only_path(&path); + + assert_eq!(path, coverart.path); + } +} + impl CoverArt { pub fn to_data(&self) -> Result, std::io::Error> { let path: &String = &self.path; diff --git a/tests/tests.rs b/tests/tests.rs index 7df899b..f281ea7 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -28,6 +28,7 @@ mod utils { } } +#[cfg(test)] mod song_tests { use std::fs::File; use std::io::Write; @@ -151,6 +152,7 @@ mod song_tests { } } +#[cfg(test)] mod album_tests { use crate::utils;