Skip to content

Commit

Permalink
tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodesdev committed Jun 4, 2024
1 parent 22f67d5 commit c1fa506
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/cli/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand All @@ -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();

Expand All @@ -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();

Expand Down

0 comments on commit c1fa506

Please sign in to comment.