Skip to content

Commit

Permalink
readme md
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodesdev committed Jun 6, 2024
1 parent 7e563f5 commit 3584435
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
8 changes: 2 additions & 6 deletions challenges/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,13 @@ mod tests {
for challenge_dir in challenges {
let dir_name = challenge_dir.file_name().unwrap().to_str().unwrap();

let description_md = challenge_dir.join("description.md");
let readme_md = challenge_dir.join("README.md");
let cargo_toml = challenge_dir.join("Cargo.toml");
let src_lib = challenge_dir.join("src/lib.rs");
let src_starter = challenge_dir.join("src/starter.rs");
let tests = challenge_dir.join("tests/tests.rs");

assert!(
description_md.exists(),
"Missing description.md in {}",
dir_name
);
assert!(readme_md.exists(), "Missing README.md in {}", dir_name);
assert!(cargo_toml.exists(), "Missing Cargo.toml in {}", dir_name);
assert!(src_lib.exists(), "Missing src/lib.rs in {}", dir_name);
assert!(tests.exists(), "Missing tests, you should have either src/tests.rs or tests/tests.rs available in {}", dir_name);
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/challenge.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub async fn challenge_exists(challenge: &str) -> anyhow::Result<bool> {
let url = "https://raw.githubusercontent.com/dcodesdev/rustfinity.com/main";
let url = format!("{}/challenges/{}/description.md", url, challenge);
let url = format!("{}/challenges/{}/README.md", url, challenge);

let client = reqwest::Client::new();
let text = client.get(url).send().await?.text().await?;
Expand Down
13 changes: 4 additions & 9 deletions crates/cli/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dload::Downloader;
use futures::future::join_all;

const FILES: [&'static str; 4] = [
"description.md",
"README.md",
"Cargo.toml",
"src/starter.rs",
"tests/tests.rs",
Expand Down Expand Up @@ -103,12 +103,7 @@ mod tests {
.await
.expect("Failed to download challenge");

let paths_to_exist = [
"description.md",
"Cargo.toml",
"src/lib.rs",
"tests/tests.rs",
];
let paths_to_exist = ["README.md", "Cargo.toml", "src/lib.rs", "tests/tests.rs"];

for file in paths_to_exist.iter() {
let path = format!("{}/{}", challenge, file);
Expand All @@ -134,14 +129,14 @@ mod tests {
fs::create_dir_all("temp/test_downloads_file").ok();
env::set_current_dir("temp/test_downloads_file").ok();

let url = "https://raw.githubusercontent.com/dcodesdev/rustfinity.com/main/challenges/hello-world/description.md";
let url = "https://raw.githubusercontent.com/dcodesdev/rustfinity.com/main/challenges/hello-world/src/lib.rs";
let challenge = "hello-world";

let result = download_file(url, challenge).await;

assert!(result.is_ok());

let path = format!("{}/description.md", challenge);
let path = format!("{}/README.md", challenge);
assert!(Path::new(&path).exists());

// read the contents of the file
Expand Down

0 comments on commit 3584435

Please sign in to comment.