From ab15fbcd1f1e7ea41b23fea503f4fa33d984c326 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 20 Oct 2025 20:33:45 -0400 Subject: [PATCH] tsk-44: Adding test --- src/detection/coverart.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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:?}"); + } + } + } +}