From ebd9fb0a2e149cd90cfc3cc202daa8ceccd62d5c Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 9 Jun 2026 23:57:43 -0400 Subject: [PATCH] Code formatting --- tests/tests.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/tests.rs b/tests/tests.rs index 618ae12..7bd28bd 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -115,13 +115,6 @@ pub mod requests { } } -#[test] -fn test_demo() { - let i = 0; - - assert_eq!(0, i, "Values should match {} {}", 0, 1); -} - const TEST_FIRSTNAME: &str = "Billy"; const TEST_LASTNAME: &str = "Bob"; const TEST_USERNAME: &str = "BillyBob01"; @@ -134,7 +127,10 @@ async fn register_user( match requests::register_user(&app).await { Ok(response) => { if axum::http::StatusCode::CREATED != response.status() { - Err(std::io::Error::other("")) + Err(std::io::Error::other(format!( + "Status code is off {:?}", + response.status() + ))) } else { match axum::body::to_bytes(response.into_body(), usize::MAX).await { Ok(body) => { @@ -158,7 +154,10 @@ async fn login_user( match requests::login_user(&app, username, password).await { Ok(response) => { if axum::http::StatusCode::OK != response.status() { - Err(std::io::Error::other("")) + Err(std::io::Error::other(format!( + "Status code is off {:?}", + response.status() + ))) } else { match axum::body::to_bytes(response.into_body(), usize::MAX).await { Ok(body) => { @@ -207,6 +206,8 @@ async fn test_register_user() { .unwrap(); let parsed_body: callers::register::response::Response = serde_json::from_slice(&body).unwrap(); + assert!(parsed_body.data.len() > 0, "No data returned"); + let returned_user = &parsed_body.data[0]; assert_eq!( @@ -249,7 +250,13 @@ async fn test_login_user() { match register_user(&app).await { Ok(user) => match login_user(&app, &user.username, TEST_PASSWORD).await { - Ok(_login_result) => {} + Ok(login_result) => { + assert_eq!( + false, + login_result.access_token.is_empty(), + "Access token is empty when it should not be" + ); + } Err(err) => { assert!(false, "Error: {err:?}"); }