Skip to content

Commit 8ccd273

Browse files
committed
use explicit imports, more descriptive names
1 parent e9ff1c1 commit 8ccd273

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/static-file-server/src/tests.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use super::*;
1+
use super::{using_serve_dir, using_serve_dir_with_assets_fallback, Router};
22
use axum::http::StatusCode;
33
use axum::{body::Body, http::Request};
44
use headers::ContentType;
55
use http_body_util::BodyExt;
66
use tower::ServiceExt;
77

8-
const INDEX_HTML: &str = include_str!("../assets/index.html");
9-
const SCRIPT_JS: &str = include_str!("../assets/script.js");
8+
const INDEX_HTML_CONTENT: &str = include_str!("../assets/index.html");
9+
const SCRIPT_JS_CONTENT: &str = include_str!("../assets/script.js");
1010

1111
async fn get_page(app: Router, path: &str) -> (StatusCode, Option<ContentType>, String) {
1212
let response = app
@@ -48,23 +48,23 @@ async fn test_using_serve_dir() {
4848
"/assets/index.html",
4949
StatusCode::OK,
5050
Some(ContentType::html()),
51-
INDEX_HTML,
51+
INDEX_HTML_CONTENT,
5252
)
5353
.await;
5454
check(
5555
app(),
5656
"/assets/script.js",
5757
StatusCode::OK,
5858
Some(ContentType::from(mime::TEXT_JAVASCRIPT)),
59-
SCRIPT_JS,
59+
SCRIPT_JS_CONTENT,
6060
)
6161
.await;
6262
check(
6363
app(),
6464
"/assets/",
6565
StatusCode::OK,
6666
Some(ContentType::html()),
67-
INDEX_HTML,
67+
INDEX_HTML_CONTENT,
6868
)
6969
.await;
7070
check(app(), "/assets/other.html", StatusCode::NOT_FOUND, None, "").await;
@@ -78,23 +78,23 @@ async fn test_using_serve_dir_with_assets_fallback() {
7878
"/assets/index.html",
7979
StatusCode::OK,
8080
Some(ContentType::html()),
81-
INDEX_HTML,
81+
INDEX_HTML_CONTENT,
8282
)
8383
.await;
8484
check(
8585
app(),
8686
"/assets/script.js",
8787
StatusCode::OK,
8888
Some(ContentType::from(mime::TEXT_JAVASCRIPT)),
89-
SCRIPT_JS,
89+
SCRIPT_JS_CONTENT,
9090
)
9191
.await;
9292
check(
9393
app(),
9494
"/assets/",
9595
StatusCode::OK,
9696
Some(ContentType::html()),
97-
INDEX_HTML,
97+
INDEX_HTML_CONTENT,
9898
)
9999
.await;
100100

0 commit comments

Comments
 (0)