From c1fa506eeb2e1b0ea145dda0185d06fdd0ce276e Mon Sep 17 00:00:00 2001 From: dcodesdev <101001810+dcodesdev@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:18:56 +0300 Subject: [PATCH] tests fix --- crates/cli/src/download.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/cli/src/download.rs b/crates/cli/src/download.rs index 8119115..88512a3 100644 --- a/crates/cli/src/download.rs +++ b/crates/cli/src/download.rs @@ -93,6 +93,8 @@ mod tests { #[tokio::test] async fn test_downloads_challenge() { + // rm temp dir if exists + fs::remove_dir_all("temp/test_downloads_challenge").ok(); fs::create_dir_all("temp/test_downloads_challenge").ok(); env::set_current_dir("temp/test_downloads_challenge").ok(); @@ -101,7 +103,12 @@ mod tests { .await .expect("Failed to download challenge"); - let paths_to_exist = ["description.md", "Cargo.toml", "src/lib.rs", "src/tests.rs"]; + let paths_to_exist = [ + "description.md", + "Cargo.toml", + "src/lib.rs", + "tests/tests.rs", + ]; for file in paths_to_exist.iter() { let path = format!("{}/{}", challenge, file); @@ -123,6 +130,7 @@ mod tests { #[tokio::test] async fn test_downloads_file() { + fs::remove_dir_all("temp/test_downloads_file").ok(); fs::create_dir_all("temp/test_downloads_file").ok(); env::set_current_dir("temp/test_downloads_file").ok(); @@ -145,6 +153,7 @@ mod tests { #[tokio::test] async fn test_download_file_sub_dir() { + fs::remove_dir_all("temp/test_download_file_sub_dir").ok(); fs::create_dir_all("temp/test_download_file_sub_dir").ok(); env::set_current_dir("temp/test_download_file_sub_dir").ok();