mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-20 17:11:19 +02:00
feature: more tests
This commit is contained in:
@@ -166,3 +166,4 @@ mod tests {
|
||||
assert_eq!(expected_urls, decoded_urls);
|
||||
}
|
||||
}
|
||||
|
||||
|
21
src/util.rs
21
src/util.rs
@@ -35,3 +35,24 @@ pub async fn cache_media(u: &str, t: &str) -> Result<String, Box<dyn Error>> {
|
||||
Ok(dest_filepath)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use std::{
|
||||
path::Path,
|
||||
fs::remove_dir_all,
|
||||
};
|
||||
|
||||
const TMP_DIR: &'static str = "/tmp/scootaloo_test";
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_cache_media() {
|
||||
let dest = cache_media("https://forum.nintendojo.fr/styles/prosilver/theme/images/ndfr_casual.png", TMP_DIR).await.unwrap();
|
||||
|
||||
assert!(Path::new(&dest).exists());
|
||||
|
||||
remove_dir_all(TMP_DIR).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user