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
test(tests): add more schema validation tests
Steven Enamakele4282a871d89
diff --git a/crates/openhuman-core/src/core/all_approval_controller_tests.rs b/crates/openhuman-core/src/core/all_approval_controller_tests.rsindex 4ff0544714..d1bcf15bee 100644--- a/crates/openhuman-core/src/core/all_approval_controller_tests.rs+++ b/crates/openhuman-core/src/core/all_approval_controller_tests.rs@@ -120,9 +120,7 @@ fn raw_approval_security_registry_matches_its_independent_contract() {("state", "ApprovalGateBootState", true),("result", "FlowPreauthorizationResult", true),];- for (index, (schema, (name, reference, required))) in- schemas.iter().zip(outputs).enumerate()- {+ for (index, (schema, (name, reference, required))) in schemas.iter().zip(outputs).enumerate() {assert_eq!(schema.outputs.len(),1,diff --git a/crates/openhuman-core/src/security/approval/schemas_tests.rs b/crates/openhuman-core/src/security/approval/schemas_tests.rsindex 295657f47b..027541a2f1 100644--- a/crates/openhuman-core/src/security/approval/schemas_tests.rs+++ b/crates/openhuman-core/src/security/approval/schemas_tests.rs@@ -205,6 +205,42 @@ fn decide_parser_preserves_parse_order_raw_values_and_four_decisions() {parse_decide(Map::from_iter([("request_id".into(), json!(null))])).unwrap_err(),"invalid 'request_id': expected string, got null");+ for (value, kind) in [+ (json!(null), "null"),+ (json!(false), "bool"),+ (json!(7), "number"),+ (json!([]), "array"),+ (json!({}), "object"),+ ] {+ assert_eq!(+ parse_decide(Map::from_iter([+ ("request_id".into(), value),+ ("decision".into(), json!(false)),+ ("agent_id".into(), json!(false)),+ ]))+ .unwrap_err(),+ format!("invalid 'request_id': expected string, got {kind}"),+ "request_id parsing precedes decision and agent_id errors"+ );+ }+ for (value, kind) in [+ (json!(null), "null"),+ (json!(false), "bool"),+ (json!(7), "number"),+ (json!([]), "array"),+ (json!({}), "object"),+ ] {+ assert_eq!(+ parse_decide(Map::from_iter([+ ("request_id".into(), json!("id")),+ ("decision".into(), value),+ ("agent_id".into(), json!(false)),+ ]))+ .unwrap_err(),+ format!("invalid 'decision': expected string, got {kind}"),+ "decision type validation precedes the invalid agent_id"+ );+ }}#[test]@@ -262,7 +298,13 @@ fn preauthorize_parser_preserves_flow_and_tool_strings_without_normalizing() {parse_preauthorize_flow(Map::from_iter([("tool_names".into(), json!([]))])).unwrap_err(),"missing required param 'flow_id'");- for value in [json!(null), json!(true), json!(7), json!("tools"), json!({})] {+ for value in [+ json!(null),+ json!(true),+ json!(7),+ json!("tools"),+ json!({}),+ ] {let kind = value_kind(&value);assert_eq!(parse_preauthorize_flow(Map::from_iter([