tsk-44: Adding test
This commit is contained in:
@@ -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:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user