feature: more tests

This commit is contained in:
VC
2022-04-23 10:15:47 +02:00
parent 8b0945cb48
commit abfb2ff50a
2 changed files with 22 additions and 0 deletions

View File

@@ -166,3 +166,4 @@ mod tests {
assert_eq!(expected_urls, decoded_urls); assert_eq!(expected_urls, decoded_urls);
} }
} }

View File

@@ -35,3 +35,24 @@ pub async fn cache_media(u: &str, t: &str) -> Result<String, Box<dyn Error>> {
Ok(dest_filepath) 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();
}
}