style: fix cargo fmt issues in pages.rs and root_landing_tests.rs

This commit is contained in:
thakares committed 2026-06-13 22:29:03 +05:30
1 parent 3c0a1bdd91
commit 02a26cfd94
2 files changed
+10 -8

No files matched your search

-1
View File
@@ -120,4 +120,3 @@ pub async fn root_landing() -> Response {
Err(_) => (StatusCode::NOT_FOUND, "Not Found").into_response(),
}
}
+10 -7
View File
@@ -6,14 +6,19 @@ use std::fs;
async fn test_root_landing_page() {
// --- Test case 1: Successful serving ---
// Read expected content
let expected_content = fs::read_to_string("www/index.html").expect("www/index.html must exist for test");
let expected_content =
fs::read_to_string("www/index.html").expect("www/index.html must exist for test");
let response = root_landing().await;
assert_eq!(response.status(), StatusCode::OK);
assert!(
response.headers().get("content-type").unwrap().to_str().unwrap().contains("text/html")
);
assert!(response
.headers()
.get("content-type")
.unwrap()
.to_str()
.unwrap()
.contains("text/html"));
// Convert response body to bytes using axum::body::to_bytes
let body_bytes = axum::body::to_bytes(response.into_body(), usize::MAX)
@@ -28,9 +33,7 @@ async fn test_root_landing_page() {
let temp_path = "www/index.html.tmp_test_bak";
fs::rename(orig_path, temp_path).unwrap();
let response_res = tokio::spawn(async move {
root_landing().await
}).await;
let response_res = tokio::spawn(async move { root_landing().await }).await;
// Restore index.html immediately in case of panic/error
let rename_res = fs::rename(temp_path, orig_path);