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 tests for config persistence and hosted provider seeding
Steven Enamakel969366bf0497
diff --git a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rsindex f3b72ce6ee..f03625a065 100644--- a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs@@ -1,5 +1,29 @@use super::*;+/// A bare-core first install persists the generic defaults and remains stable+/// when reopened. Hosted provider seeding is covered by TinyHumans' registered+/// normalizer tests, not by core's config creation path.+#[tokio::test]+async fn a_brand_new_workspace_persists_and_reopens_generic_config() {+ let tmp = tempfile::tempdir().unwrap();+ let first = load_or_init_for_workspace(tmp.path()).await;+ assert!(first.default_model.is_none());+ assert!(first+ .cloud_providers+ .iter()+ .all(|provider| provider.slug != "openhuman"));++ let first_text = tokio::fs::read_to_string(&first.config_path).await.unwrap();+ assert!(first_text.contains("schema_version"));++ let second = load_or_init_for_workspace(tmp.path()).await;+ assert!(second.default_model.is_none());+ assert!(second+ .cloud_providers+ .iter()+ .all(|provider| provider.slug != "openhuman"));+}+#[tokio::test]async fn bare_core_advances_schema_without_inventing_hosted_defaults() {let tmp = tempfile::tempdir().unwrap();diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rsindex 8a6dcc0372..24a274334e 100644--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs@@ -94,6 +94,24 @@ fn hosted_normalizer_covers_all_legacy_model_fields_and_preserves_non_tiers() {assert_eq!(absent.default_model, None);}+#[test]+fn hosted_normalizer_seeds_its_preset_using_the_configured_api_url_once() {+ let mut config = Config::default();+ config.api_url = Some("https://custom.example/api".to_string());++ assert!(normalize_config(&mut config));+ assert_eq!(config.default_model, None);+ assert_eq!(config.cloud_providers.len(), 1);+ let provider = &config.cloud_providers[0];+ assert_eq!(provider.slug, "openhuman");+ assert_eq!(provider.endpoint, "https://custom.example/api");+ let id = provider.id.clone();++ assert!(!normalize_config(&mut config));+ assert_eq!(config.cloud_providers.len(), 1);+ assert_eq!(config.cloud_providers[0].id, id);+}+#[test]fn managed_tier_vocabulary_maps_aliases_and_leaves_concrete_ids_raw() {for (model, role) in [