Skip to content

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

test(tests): update various unit tests

Steven Enamakel928e9159c567
diff --git a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
index a2640a9fdb..c4f13a7d0a 100644
--- a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
+++ b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
@@ -154,6 +154,11 @@ fn hosted_presets_and_classification_are_context_scoped() {
assert!(super::builtin_cloud_provider("tenant-hosted").is_none());
crate::core::runtime::CoreContext::sync_scope(context, || {
+ let presets = super::builtin_cloud_providers();
+ assert_eq!(presets[0].slug, "tenant-hosted");
+ assert_eq!(presets[0].label, "Tenant Hosted");
+ assert_eq!(presets[0].endpoint, "https://tenant.example/v1");
+ assert!(presets.iter().any(|preset| preset.slug == "openai"));
assert!(super::builtin_cloud_provider("tenant-hosted").is_some());
assert!(super::is_hosted_cloud_identity("tenant-hosted"));
assert!(!super::is_hosted_auth_style(AuthStyle::Bearer));
diff --git a/crates/openhuman-core/src/config/schema/identity_cost_tests.rs b/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
index 452dc15e9e..9e7f695e6a 100644
--- a/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
+++ b/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
@@ -29,20 +29,6 @@ fn cost_dashboard_config_serde_roundtrip() {
assert!((c.dashboard.alert_threshold - 0.9).abs() < f64::EPSILON);
}
-/// Pre-existing failure, unrelated to the spend cap: dc5c014da consolidated
-/// pricing onto a single managed default and left this asserting `>= 3`, which
-/// `get_default_pricing` — one entry — can never satisfy. Pinning the entry
-/// that must exist says what the default pricing is actually for; a count says
-/// nothing and goes stale the next time the catalogue is consolidated.
-#[test]
-fn cost_config_default_pricing_has_known_models() {
- let c = CostConfig::default();
- assert!(
- c.prices.is_empty(),
- "bare core has no provider-owned price catalog"
- );
-}
-
#[test]
fn cost_config_serde_roundtrip() {
let c = CostConfig::default();
diff --git a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
index d9d7d93f81..69e5fc5400 100644
--- a/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/tiers_tests.rs
@@ -165,6 +165,21 @@ fn hosted_normalizer_leaves_custom_and_explicit_primary_choices_alone() {
assert_eq!(selected.primary_cloud.as_deref(), Some("p_custom"));
}
+#[test]
+fn hosted_cost_defaults_include_the_registered_managed_model_price() {
+ let _registry = crate::registry_test_lock();
+ crate::register::register_all(&crate::install::InstallOptions::default());
+
+ let prices = openhuman_embed::__host::config::schema::CostConfig::default().prices;
+ let expected = super::super::tiers::default_pricing().expect("hosted default pricing");
+ assert_eq!(expected.0, MODEL_MANAGED_DEFAULT);
+ let actual = prices
+ .get(MODEL_MANAGED_DEFAULT)
+ .expect("hosted cost defaults expose their owned managed price");
+ assert!((actual.input - expected.1).abs() < f64::EPSILON);
+ assert!((actual.output - expected.2).abs() < f64::EPSILON);
+}
+
#[test]
fn managed_tier_vocabulary_maps_aliases_and_leaves_concrete_ids_raw() {
for (model, role) in [