The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(core): extract subsystem schema tests to separate file
Steven Enamakel6e9461bc4116
diff --git a/crates/openhuman-core/src/core/subsystem/schemas.rs b/crates/openhuman-core/src/core/subsystem/schemas.rsindex e6896b5963..b7ba7a3b1d 100644--- a/crates/openhuman-core/src/core/subsystem/schemas.rs+++ b/crates/openhuman-core/src/core/subsystem/schemas.rs@@ -85,42 +85,5 @@ fn handle_status(_params: Map<String, Value>) -> ControllerFuture {}#[cfg(test)]-mod tests {- use super::*;-- #[test]- fn status_schema_shape() {- let schema = schemas("status");- assert_eq!(schema.namespace, "subsystems");- assert_eq!(schema.function, "status");- assert!(schema.inputs.is_empty());- assert_eq!(schema.outputs.len(), 1);- assert_eq!(schema.outputs[0].name, "subsystems");- }-- #[test]- fn unknown_function_returns_the_unknown_schema() {- assert_eq!(schemas("not_real").function, "unknown");- }-- #[test]- fn schemas_and_controllers_line_up() {- let schemas = all_controller_schemas();- let controllers = all_registered_controllers();- assert_eq!(schemas.len(), controllers.len());- for (schema, controller) in schemas.iter().zip(controllers.iter()) {- assert_eq!(schema.namespace, controller.schema.namespace);- assert_eq!(schema.function, controller.schema.function);- }- }-- #[tokio::test]- async fn handler_returns_a_subsystems_array_containing_the_memory_slot() {- let value = handle_status(Map::new()).await.expect("handler succeeds");- let rows = value["subsystems"].as_array().expect("array");- assert_eq!(rows.len(), 1);- assert_eq!(rows[0]["slot"], "memory");- assert!(rows[0]["contract_version"].is_string());- assert!(rows[0]["capabilities"].is_array());- }-}+#[path = "schemas_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/core/subsystem/schemas_tests.rs b/crates/openhuman-core/src/core/subsystem/schemas_tests.rsnew file mode 100644index 0000000000..d981521c9e--- /dev/null+++ b/crates/openhuman-core/src/core/subsystem/schemas_tests.rs@@ -0,0 +1,38 @@+use super::*;+ use super::*;++ #[test]+ fn status_schema_shape() {+ let schema = schemas("status");+ assert_eq!(schema.namespace, "subsystems");+ assert_eq!(schema.function, "status");+ assert!(schema.inputs.is_empty());+ assert_eq!(schema.outputs.len(), 1);+ assert_eq!(schema.outputs[0].name, "subsystems");+ }++ #[test]+ fn unknown_function_returns_the_unknown_schema() {+ assert_eq!(schemas("not_real").function, "unknown");+ }++ #[test]+ fn schemas_and_controllers_line_up() {+ let schemas = all_controller_schemas();+ let controllers = all_registered_controllers();+ assert_eq!(schemas.len(), controllers.len());+ for (schema, controller) in schemas.iter().zip(controllers.iter()) {+ assert_eq!(schema.namespace, controller.schema.namespace);+ assert_eq!(schema.function, controller.schema.function);+ }+ }++ #[tokio::test]+ async fn handler_returns_a_subsystems_array_containing_the_memory_slot() {+ let value = handle_status(Map::new()).await.expect("handler succeeds");+ let rows = value["subsystems"].as_array().expect("array");+ assert_eq!(rows.len(), 1);+ assert_eq!(rows[0]["slot"], "memory");+ assert!(rows[0]["contract_version"].is_string());+ assert!(rows[0]["capabilities"].is_array());+ }diff --git a/crates/openhuman-core/src/threads/schemas.rs b/crates/openhuman-core/src/threads/schemas.rsindex 01cd2cec05..fbdc43b592 100644--- a/crates/openhuman-core/src/threads/schemas.rs+++ b/crates/openhuman-core/src/threads/schemas.rs@@ -12,3 +12,5 @@ pub use registry::{all_controller_schemas, all_registered_controllers};#[cfg(test)]pub(crate) use schema_defs::schemas;+#[cfg(test)]+use handlers::{handle_task_board_get, handle_task_board_put};