Skip to content

Commit 11fa6c0

Browse files
committed
style: cargo fmt cleanup in coverage test modules
Auto-fixes from `cargo fmt` on test code added in batches 4.1–4.3. No behavioral changes.
1 parent 7e100ef commit 11fa6c0

11 files changed

Lines changed: 71 additions & 40 deletions

File tree

src/openhuman/migration/ops.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ mod tests {
4242
match result {
4343
Ok(outcome) => {
4444
assert!(
45-
outcome.logs.iter().any(|l| l.contains("migration completed")),
45+
outcome
46+
.logs
47+
.iter()
48+
.any(|l| l.contains("migration completed")),
4649
"expected 'migration completed' log, got logs: {:?}",
4750
outcome.logs
4851
);

src/openhuman/referral/ops.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ mod tests {
199199
async fn claim_referral_posts_trimmed_code_and_drops_whitespace_fingerprint() {
200200
let app = Router::new().route(
201201
"/referral/claim",
202-
post(|Json(body): Json<Value>| async move {
203-
Json(json!({ "echoed": body }))
204-
}),
202+
post(|Json(body): Json<Value>| async move { Json(json!({ "echoed": body })) }),
205203
);
206204
let base = spawn_mock(app).await;
207205
let tmp = TempDir::new().unwrap();
@@ -226,9 +224,7 @@ mod tests {
226224
async fn claim_referral_forwards_non_empty_device_fingerprint_trimmed() {
227225
let app = Router::new().route(
228226
"/referral/claim",
229-
post(|Json(body): Json<Value>| async move {
230-
Json(json!({ "echoed": body }))
231-
}),
227+
post(|Json(body): Json<Value>| async move { Json(json!({ "echoed": body })) }),
232228
);
233229
let base = spawn_mock(app).await;
234230
let tmp = TempDir::new().unwrap();

src/openhuman/service/ops.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ mod tests {
102102
// No assertion on `show_tray` value — defaults vary by build.
103103
// The contract under test is that the function returns Ok with
104104
// the canonical log line and a deterministic struct shape.
105-
assert!(out.logs.iter().any(|l| l.contains("daemon host config loaded")));
105+
assert!(out
106+
.logs
107+
.iter()
108+
.any(|l| l.contains("daemon host config loaded")));
106109
let _ = out.value.show_tray;
107110
}
108111

@@ -121,7 +124,10 @@ mod tests {
121124
.any(|l| l.contains("daemon host config saved")));
122125

123126
let loaded = daemon_host_get(&config).await.unwrap();
124-
assert!(!loaded.value.show_tray, "set→get round-trip must observe the persisted value");
127+
assert!(
128+
!loaded.value.show_tray,
129+
"set→get round-trip must observe the persisted value"
130+
);
125131

126132
// Flip it back and confirm the toggle round-trips too.
127133
let saved = daemon_host_set(&config, true).await.unwrap();

src/openhuman/text_input/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ mod tests {
172172
// key keep working) and preserve the None round-trip.
173173
let parsed: ReadFieldParams = serde_json::from_value(json!({})).unwrap();
174174
assert!(parsed.include_bounds.is_none());
175-
let parsed: ReadFieldParams = serde_json::from_value(json!({"include_bounds": true})).unwrap();
175+
let parsed: ReadFieldParams =
176+
serde_json::from_value(json!({"include_bounds": true})).unwrap();
176177
assert_eq!(parsed.include_bounds, Some(true));
177178
}
178179

src/openhuman/update/ops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ mod tests {
142142

143143
#[test]
144144
fn validate_download_url_rejects_non_https_schemes() {
145-
let err =
146-
validate_download_url("http://github.com/owner/repo/releases/download/v1/x").unwrap_err();
145+
let err = validate_download_url("http://github.com/owner/repo/releases/download/v1/x")
146+
.unwrap_err();
147147
assert!(err.contains("must use HTTPS"), "got: {err}");
148148
}
149149

src/openhuman/voice/postprocess.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,7 @@ mod tests {
309309
.unwrap_or_else(|p| p.into_inner());
310310
let app = Router::new().route(
311311
"/api/generate",
312-
post(|| async {
313-
Json(json!({"model":"test","response":" ","done": true}))
314-
}),
312+
post(|| async { Json(json!({"model":"test","response":" ","done": true})) }),
315313
);
316314
let base = spawn_mock(app).await;
317315
let config = Config::default();
@@ -372,8 +370,7 @@ mod tests {
372370
let config = Config::default();
373371
let raw = "raw text";
374372
let result = with_ready_llm(base, &config, || async {
375-
cleanup_transcription(&config, raw, Some("previous turn: check the oven"))
376-
.await
373+
cleanup_transcription(&config, raw, Some("previous turn: check the oven")).await
377374
})
378375
.await;
379376
if result.contains("Conversation context:") {

src/openhuman/voice/text_input.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,7 @@ mod tests {
224224
assert_eq!(escape_applescript_string(r"a\b"), r"a\\b");
225225
// Backslash must be escaped BEFORE quotes so the order of
226226
// substitutions doesn't double-escape already-escaped quotes.
227-
assert_eq!(
228-
escape_applescript_string(r#"\"mix"#),
229-
r#"\\\"mix"#
230-
);
227+
assert_eq!(escape_applescript_string(r#"\"mix"#), r#"\\\"mix"#);
231228
}
232229

233230
#[cfg(target_os = "macos")]

src/openhuman/webhooks/ops.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,10 @@ mod tests {
344344
.await
345345
.unwrap();
346346
assert!(out.value.registrations.is_empty());
347-
assert!(out.logs.iter().any(|l| l.contains("registered tunnel uuid-1")));
347+
assert!(out
348+
.logs
349+
.iter()
350+
.any(|l| l.contains("registered tunnel uuid-1")));
348351
}
349352

350353
#[tokio::test]
@@ -382,7 +385,9 @@ mod tests {
382385
Some("application/json")
383386
);
384387
assert_eq!(
385-
resp.headers.get("x-openhuman-webhook-target").map(String::as_str),
388+
resp.headers
389+
.get("x-openhuman-webhook-target")
390+
.map(String::as_str),
386391
Some("echo")
387392
);
388393
// Decode the body and check the echoed fields survived the round-trip.
@@ -417,8 +422,14 @@ mod tests {
417422
let tmp = TempDir::new().unwrap();
418423
let config = test_config(&tmp);
419424
for id in ["", " "] {
420-
assert!(get_tunnel(&config, id).await.unwrap_err().contains("id is required"));
421-
assert!(delete_tunnel(&config, id).await.unwrap_err().contains("id is required"));
425+
assert!(get_tunnel(&config, id)
426+
.await
427+
.unwrap_err()
428+
.contains("id is required"));
429+
assert!(delete_tunnel(&config, id)
430+
.await
431+
.unwrap_err()
432+
.contains("id is required"));
422433
assert!(update_tunnel(&config, id, json!({}))
423434
.await
424435
.unwrap_err()
@@ -439,7 +450,10 @@ mod tests {
439450
let config = config_with_backend(&tmp, base);
440451
let out = list_tunnels(&config).await.unwrap();
441452
assert_eq!(out.value["tunnels"][0]["id"], json!("t-1"));
442-
assert!(out.logs.iter().any(|l| l.contains("webhook tunnels fetched")));
453+
assert!(out
454+
.logs
455+
.iter()
456+
.any(|l| l.contains("webhook tunnels fetched")));
443457
}
444458

445459
#[tokio::test]

src/openhuman/webhooks/schemas.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,11 @@ mod tests {
437437
#[test]
438438
fn all_controller_schemas_entries_are_all_under_webhooks_namespace() {
439439
for s in all_controller_schemas() {
440-
assert_eq!(s.namespace, "webhooks", "schema `{}` has wrong namespace", s.function);
440+
assert_eq!(
441+
s.namespace, "webhooks",
442+
"schema `{}` has wrong namespace",
443+
s.function
444+
);
441445
assert!(
442446
!s.description.trim().is_empty(),
443447
"schema `{}` must have a description",
@@ -472,13 +476,21 @@ mod tests {
472476
clone.dedup();
473477
clone.len()
474478
};
475-
assert_eq!(unique_count, names.len(), "duplicate function names: {names:?}");
479+
assert_eq!(
480+
unique_count,
481+
names.len(),
482+
"duplicate function names: {names:?}"
483+
);
476484
}
477485

478486
// ── schemas(function) per-arm coverage ───────────────────────
479487

480488
fn required_input_names(s: &ControllerSchema) -> Vec<&'static str> {
481-
s.inputs.iter().filter(|f| f.required).map(|f| f.name).collect()
489+
s.inputs
490+
.iter()
491+
.filter(|f| f.required)
492+
.map(|f| f.name)
493+
.collect()
482494
}
483495

484496
#[test]
@@ -519,7 +531,9 @@ mod tests {
519531
.find(|f| f.name == optional)
520532
.unwrap_or_else(|| panic!("missing optional `{optional}`"));
521533
assert!(!f.required);
522-
assert!(matches!(&f.ty, TypeSchema::Option(inner) if matches!(**inner, TypeSchema::String)));
534+
assert!(
535+
matches!(&f.ty, TypeSchema::Option(inner) if matches!(**inner, TypeSchema::String))
536+
);
523537
}
524538
}
525539

@@ -538,7 +552,10 @@ mod tests {
538552
fn create_tunnel_requires_name_and_allows_optional_description() {
539553
let s = schemas("create_tunnel");
540554
assert_eq!(required_input_names(&s), vec!["name"]);
541-
assert!(s.inputs.iter().any(|f| f.name == "description" && !f.required));
555+
assert!(s
556+
.inputs
557+
.iter()
558+
.any(|f| f.name == "description" && !f.required));
542559
}
543560

544561
#[test]

src/openhuman/webhooks/types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ mod tests {
240240
let s = serde_json::to_string(&resp).unwrap();
241241
let back: WebhookResponseData = serde_json::from_str(&s).unwrap();
242242
assert_eq!(back.status_code, 200);
243-
assert_eq!(back.headers.get("Content-Type").map(String::as_str), Some("text/plain"));
243+
assert_eq!(
244+
back.headers.get("Content-Type").map(String::as_str),
245+
Some("text/plain")
246+
);
244247
assert_eq!(back.body, "Zm9v");
245248
}
246249

0 commit comments

Comments
 (0)