Skip to content

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

test(tinyhumans): add install tests

Steven Enamakelf3e716edef25
diff --git a/crates/openhuman-tinyhumans/src/install_tests.rs b/crates/openhuman-tinyhumans/src/install_tests.rs
new file mode 100644
index 0000000000..1eb560b202
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/install_tests.rs
@@ -0,0 +1,56 @@
+//! `install` and the builder share `wiring`: these pin what each option
+//! resolves to and that `install` applies it to the process globals.
+
+use super::*;
+use openhuman_embed::__host::agent::tinyagents::discovery::installed_tool_ranker;
+use openhuman_embed::seams::DomainGroup;
+
+#[test]
+fn default_wiring_carries_hosted_controllers_and_the_jev_ranker() {
+ let wired = wiring(&InstallOptions::default()).expect("wiring");
+ assert_eq!(
+ wired.controllers.as_ref().map(|ext| ext.group),
+ Some(DomainGroup::Hosted)
+ );
+ #[cfg(feature = "jev")]
+ assert!(wired.ranker.is_some());
+ #[cfg(not(feature = "jev"))]
+ assert!(wired.ranker.is_none());
+ assert!(installed_backend_transport().is_some());
+ let shown = format!("{wired:?}");
+ assert!(shown.contains("Hosted"), "{shown}");
+}
+
+#[test]
+fn options_turn_controllers_and_ranker_off() {
+ let wired = wiring(
+ &InstallOptions::default()
+ .hosted_controllers(false)
+ .tool_ranker(false),
+ )
+ .expect("wiring");
+ assert!(wired.controllers.is_none());
+ assert!(wired.ranker.is_none());
+}
+
+#[test]
+fn wiring_reuses_the_process_transport() {
+ let first = wiring(&InstallOptions::default()).expect("first");
+ let second = wiring(&InstallOptions::default()).expect("second");
+ assert!(Arc::ptr_eq(&first.transport, &second.transport));
+}
+
+#[test]
+fn install_registers_hosted_controllers_and_installs_the_ranker() {
+ let transport = install(InstallOptions::default()).expect("install");
+ assert!(is_installed());
+ assert!(
+ openhuman_embed::schema_for_rpc_method("openhuman.billing_get_summary").is_some(),
+ "hosted controllers must be in the core registry"
+ );
+ #[cfg(feature = "jev")]
+ assert!(installed_tool_ranker().is_some());
+ // The same transport the builder path binds.
+ let wired = wiring(&InstallOptions::default()).expect("wiring");
+ assert!(Arc::ptr_eq(&transport, &wired.transport));
+}