diff --git a/Cargo.toml b/Cargo.toml index 70ebe64..f62f385 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ members = [ "domain_impl", "host", "infra", - "integrtion-tests", + "integration-tests", "acl" ] diff --git a/integrtion-tests/Cargo.toml b/integration-tests/Cargo.toml similarity index 100% rename from integrtion-tests/Cargo.toml rename to integration-tests/Cargo.toml diff --git a/integrtion-tests/tests/gen.rs b/integration-tests/tests/gen.rs similarity index 100% rename from integrtion-tests/tests/gen.rs rename to integration-tests/tests/gen.rs diff --git a/integrtion-tests/tests/sut.rs b/integration-tests/tests/sut.rs similarity index 80% rename from integrtion-tests/tests/sut.rs rename to integration-tests/tests/sut.rs index feb1047..5db436e 100644 --- a/integrtion-tests/tests/sut.rs +++ b/integration-tests/tests/sut.rs @@ -44,12 +44,10 @@ impl Sut { let response = client.get(uri).send().await.unwrap(); - if response.status() == StatusCode::OK { - let user: UserResponse = response.json().await.unwrap(); - - Ok(user) - } else { - Err(response.text().await.unwrap()) + match response.status() { + StatusCode::OK => Ok(response.json().await.unwrap()), + StatusCode::BAD_REQUEST => Err(response.text().await.unwrap()), + code => Err(format!("unexpected status code {}", code)) } } @@ -68,12 +66,9 @@ impl Sut { .await .unwrap(); - if response.status() == StatusCode::CREATED { - let user: CreatedUserIdResponse = response.json().await.unwrap(); - - Ok(user) - } else { - Err(response.text().await.unwrap()) + match response.status() { + StatusCode::CREATED => Ok(response.json().await.unwrap()), + code => Err(format!("unexpected status code {}", code)) } } @@ -83,10 +78,9 @@ impl Sut { let response = client.post(uri).json(&activity).send().await.unwrap(); - if response.status() == StatusCode::OK { - Ok(()) - } else { - Err(response.text().await.unwrap()) + match response.status() { + StatusCode::OK => Ok(()), + code => Err(format!("unexpected status code {}", code)) } } diff --git a/integrtion-tests/tests/user_tests.rs b/integration-tests/tests/user_tests.rs similarity index 100% rename from integrtion-tests/tests/user_tests.rs rename to integration-tests/tests/user_tests.rs diff --git a/run_tests.sh b/run_tests.sh index c140727..4d24163 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -20,7 +20,7 @@ cargo test --workspace find . -path "*/${timestamp}/*" -name '*.profraw' -exec mv {} "./${directory_path}" \; # generate report -grcov "${directory_path}" --binary-path target/debug -s . -o "${directory_path}" --ignore "target/debug/*" --ignore "integrtion-tests/*" --output-types html +grcov "${directory_path}" --binary-path target/debug -s . -o "${directory_path}" --ignore "target/debug/*" --ignore "integration-tests/*" --output-types html # open report open "./${directory_path}/html/index.html" \ No newline at end of file