Skip to content

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

test(openhuman-embed): add test module for host internals

Steven Enamakelf2a0dd5a8b0c
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index 464fde36c4..c3e9263c24 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -333,3 +333,7 @@ pub mod web_chat {
ChatRequestMetadata, GuardrailPayload, StartChatError, WebChannelEvent,
};
}
+
+#[cfg(test)]
+#[path = "host_internals_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-embed/src/host_internals_tests.rs b/crates/openhuman-embed/src/host_internals_tests.rs
new file mode 100644
index 0000000000..39b70c3eed
--- /dev/null
+++ b/crates/openhuman-embed/src/host_internals_tests.rs
@@ -0,0 +1,18 @@
+use super::*;
+
+// Without voice and the HTTP server the core has no socket handlers; the
+// stand-ins accept and drop whatever rpc hands them.
+#[cfg(not(all(feature = "voice", feature = "http-server")))]
+#[tokio::test]
+async fn the_voice_socket_stand_ins_drop_their_arguments() {
+ voice::live::ws::handle_live_voice_ws((), ()).await;
+ voice::streaming::handle_dictation_ws((), ()).await;
+}
+
+// With both features the real handlers are re-exported under the same paths.
+#[cfg(all(feature = "voice", feature = "http-server"))]
+#[test]
+fn the_voice_socket_handlers_are_the_cores() {
+ let _live = voice::live::ws::handle_live_voice_ws;
+ let _dictation = voice::streaming::handle_dictation_ws;
+}