Formatting

This commit is contained in:
2026-04-19 15:35:10 +02:00
parent 041f9015ca
commit 0d5c2f5888
42 changed files with 612 additions and 357 deletions
+21 -18
View File
@@ -82,9 +82,7 @@ fn get_with_if_none_match(uri: &str, etag: &str) -> Request<Body> {
.unwrap()
}
async fn body_json(
response: axum::http::Response<axum::body::Body>,
) -> serde_json::Value {
async fn body_json(response: axum::http::Response<axum::body::Body>) -> serde_json::Value {
let bytes = axum::body::to_bytes(response.into_body(), usize::MAX)
.await
.unwrap();
@@ -142,7 +140,13 @@ async fn empty_user_dir_returns_200_empty_list() {
async fn recent_case_with_oneliner_shows_up() {
let (config, dp) = test_config();
let case_id = "550e8400-e29b-41d4-a716-000000000001";
seed_case(&dp, case_id, Duration::from_secs(60), Some("Kniegelenk re., V.a. Meniskus")).await;
seed_case(
&dp,
case_id,
Duration::from_secs(60),
Some("Kniegelenk re., V.a. Meniskus"),
)
.await;
let app = doctate_server::create_router(config);
let response = app.oneshot(get("/api/oneliners")).await.unwrap();
@@ -161,7 +165,13 @@ async fn recent_case_with_oneliner_shows_up() {
#[tokio::test]
async fn case_without_oneliner_shows_null() {
let (config, dp) = test_config();
seed_case(&dp, "550e8400-e29b-41d4-a716-000000000002", Duration::from_secs(60), None).await;
seed_case(
&dp,
"550e8400-e29b-41d4-a716-000000000002",
Duration::from_secs(60),
None,
)
.await;
let app = doctate_server::create_router(config);
let body = body_json(app.oneshot(get("/api/oneliners")).await.unwrap()).await;
@@ -202,10 +212,7 @@ async fn case_outside_default_but_inside_custom_window_included() {
.await;
let app = doctate_server::create_router(config);
let body = body_json(
app.oneshot(get("/api/oneliners?hours=48")).await.unwrap(),
)
.await;
let body = body_json(app.oneshot(get("/api/oneliners?hours=48")).await.unwrap()).await;
assert_eq!(body["window_hours"], 48);
assert_eq!(body["oneliners"].as_array().unwrap().len(), 1);
@@ -218,7 +225,9 @@ async fn hours_clamped_to_max() {
let app = doctate_server::create_router(config);
let body = body_json(
app.oneshot(get("/api/oneliners?hours=999999")).await.unwrap(),
app.oneshot(get("/api/oneliners?hours=999999"))
.await
.unwrap(),
)
.await;
assert_eq!(body["window_hours"], 168);
@@ -284,10 +293,7 @@ async fn etag_differs_between_different_hours() {
.oneshot(get("/api/oneliners?hours=1"))
.await
.unwrap();
let r16 = app
.oneshot(get("/api/oneliners?hours=16"))
.await
.unwrap();
let r16 = app.oneshot(get("/api/oneliners?hours=16")).await.unwrap();
let etag1 = header_str(&r1, "etag");
let etag16 = header_str(&r16, "etag");
@@ -407,10 +413,7 @@ async fn sorts_by_last_recording_not_created() {
.await;
let app = doctate_server::create_router(config);
let body = body_json(
app.oneshot(get("/api/oneliners?hours=48")).await.unwrap(),
)
.await;
let body = body_json(app.oneshot(get("/api/oneliners?hours=48")).await.unwrap()).await;
let arr = body["oneliners"].as_array().unwrap();
assert_eq!(arr.len(), 2);
assert_eq!(arr[0]["case_id"], case_a, "A must sort first");