Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style(core): reformat schema test helpers and assertions

Steven Enamakel405ceaa9eb89
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index 0ddfb81bda..2a13e0bc0f 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -1211,9 +1211,18 @@ pub(crate) fn expect_schema_fields(schema: &ControllerSchema, fields: &[(&str, O
.inputs
.iter()
.find(|field| field.name == *name)
- .unwrap_or_else(|| panic!("{}.{} is missing input `{name}`", schema.namespace, schema.function));
+ .unwrap_or_else(|| {
+ panic!(
+ "{}.{} is missing input `{name}`",
+ schema.namespace, schema.function
+ )
+ });
if let Some(required) = required {
- assert_eq!(field.required, *required, "{}.{} input `{name}`", schema.namespace, schema.function);
+ assert_eq!(
+ field.required, *required,
+ "{}.{} input `{name}`",
+ schema.namespace, schema.function
+ );
}
}
}
@@ -1226,19 +1235,31 @@ pub(crate) fn expect_schema_required_inputs(schema: &ControllerSchema, required:
.filter(|field| field.required)
.map(|field| field.name)
.collect();
- assert_eq!(actual, required, "{}.{} required inputs", schema.namespace, schema.function);
+ assert_eq!(
+ actual, required,
+ "{}.{} required inputs",
+ schema.namespace, schema.function
+ );
}
#[cfg(test)]
pub(crate) fn expect_schema_input_order(schema: &ControllerSchema, inputs: &[&str]) {
let actual: Vec<_> = schema.inputs.iter().map(|field| field.name).collect();
- assert_eq!(actual, inputs, "{}.{} input order", schema.namespace, schema.function);
+ assert_eq!(
+ actual, inputs,
+ "{}.{} input order",
+ schema.namespace, schema.function
+ );
}
#[cfg(test)]
pub(crate) fn expect_schema_output_names(schema: &ControllerSchema, outputs: &[&str]) {
let actual: Vec<_> = schema.outputs.iter().map(|field| field.name).collect();
- assert_eq!(actual, outputs, "{}.{} output names", schema.namespace, schema.function);
+ assert_eq!(
+ actual, outputs,
+ "{}.{} output names",
+ schema.namespace, schema.function
+ );
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/mcp/ui/schemas_tests.rs b/crates/openhuman-core/src/mcp/ui/schemas_tests.rs
index 366d5dbdbe..76aee4bc69 100644
--- a/crates/openhuman-core/src/mcp/ui/schemas_tests.rs
+++ b/crates/openhuman-core/src/mcp/ui/schemas_tests.rs
@@ -6,7 +6,10 @@ use crate::core::runtime::DispatchCtx;
fn mcp_ui_schema_contracts_are_preserved() {
let schema = schemas("tool_call");
expect_schema_identity(&schema, "mcp_ui", "tool_call");
- expect_schema_fields(&schema, &[("server_id", Some(true)), ("tool_name", Some(true))]);
+ expect_schema_fields(
+ &schema,
+ &[("server_id", Some(true)), ("tool_name", Some(true))],
+ );
}
async fn with_workspace<F: std::future::Future>(body: F) -> F::Output {
diff --git a/crates/openhuman-core/src/security/credentials/schemas_tests.rs b/crates/openhuman-core/src/security/credentials/schemas_tests.rs
index ddc5679e25..c264b0f151 100644
--- a/crates/openhuman-core/src/security/credentials/schemas_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/schemas_tests.rs
@@ -1,13 +1,21 @@
use super::*;
-use crate::core::all::{expect_schema_fields, expect_schema_identity, expect_schema_required_inputs};
+use crate::core::all::{
+ expect_schema_fields, expect_schema_identity, expect_schema_required_inputs,
+};
#[test]
fn credential_schema_wire_contracts_are_preserved() {
let key_contracts = [
("auth_get_state", "get_state"),
("auth_get_session_token", "get_session_token"),
- ("auth_store_provider_credentials", "store_provider_credentials"),
- ("auth_remove_provider_credentials", "remove_provider_credentials"),
+ (
+ "auth_store_provider_credentials",
+ "store_provider_credentials",
+ ),
+ (
+ "auth_remove_provider_credentials",
+ "remove_provider_credentials",
+ ),
];
for (key, expected_function) in key_contracts {
let schema = schemas(key);
diff --git a/crates/openhuman-core/src/security/devices/schemas_tests.rs b/crates/openhuman-core/src/security/devices/schemas_tests.rs
index 6b4981bec5..d5e0bde070 100644
--- a/crates/openhuman-core/src/security/devices/schemas_tests.rs
+++ b/crates/openhuman-core/src/security/devices/schemas_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use crate::core::all::{
expect_schema_fields, expect_schema_identity, expect_schema_input_order,
- expect_schema_output_names, expect_schema_output_fields,
+ expect_schema_output_fields, expect_schema_output_names,
};
use serde_json::json;
diff --git a/crates/openhuman-core/src/tools/schemas_tests.rs b/crates/openhuman-core/src/tools/schemas_tests.rs
index 13f54e4e61..1d5e904731 100644
--- a/crates/openhuman-core/src/tools/schemas_tests.rs
+++ b/crates/openhuman-core/src/tools/schemas_tests.rs
@@ -34,7 +34,10 @@ fn tools_schema_wire_contracts_are_preserved() {
("composio_execute", &[("action", Some(true))]),
("web_answer", &[("query", Some(true)), ("depth", None)]),
("web_contents", &[("urls", Some(true))]),
- ("searxng_search", &[("query", Some(true)), ("max_results", None)]),
+ (
+ "searxng_search",
+ &[("query", Some(true)), ("max_results", None)],
+ ),
("web_search", &[("query", Some(true))]),
];
for (function, inputs) in contracts {
diff --git a/crates/openhuman-core/src/web3/wallet/schemas_tests.rs b/crates/openhuman-core/src/web3/wallet/schemas_tests.rs
index 54548815b6..a3f629aaf7 100644
--- a/crates/openhuman-core/src/web3/wallet/schemas_tests.rs
+++ b/crates/openhuman-core/src/web3/wallet/schemas_tests.rs
@@ -19,7 +19,10 @@ fn wallet_schema_wire_contracts_are_preserved() {
assert!(status.inputs.is_empty());
let setup = wallet_schemas("setup");
assert_eq!(setup.inputs.len(), 6);
- expect_schema_fields(&setup, &[("encryptedMnemonic", Some(true)), ("force", Some(false))]);
+ expect_schema_fields(
+ &setup,
+ &[("encryptedMnemonic", Some(true)), ("force", Some(false))],
+ );
expect_schema_fields(
&wallet_schemas("validate_mnemonic"),
&[("phrase", Some(true))],