tsk-44: Adding test

This commit is contained in:
2025-10-20 20:33:45 -04:00
parent 3055371248
commit ab15fbcd1f

View File

@@ -18,3 +18,22 @@ pub fn file_type(filepath: &str) -> Result<String, std::io::Error> {
}
}
}
#[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:?}");
}
}
}
}