diff --git a/src/detection/coverart.rs b/src/detection/coverart.rs index cdb5a99..b978e67 100644 --- a/src/detection/coverart.rs +++ b/src/detection/coverart.rs @@ -18,3 +18,22 @@ pub fn file_type(filepath: &str) -> Result { } } } + +#[cfg(test)] +mod tests { + #[test] + fn test_coverart_file_type() { + let directory = String::from(crate::test_util::util::TESTFILEDIRECTORY); + let filename = String::from("Sample Tracks 3.png"); + let filepath = format!("{directory}/{filename}"); + + match super::file_type(&filepath) { + Ok(filetype) => { + assert_eq!(filetype, "png", "The file type of the CoverArt should have been png"); + } + Err(err) => { + assert!(false, "Error: {err:?}"); + } + } + } +}