Skip to content

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

chore(tests): add test coverage for ops components and voice modules

Steven Enamakelc54d021fc3f1
diff --git a/crates/openhuman-core/src/modules/ops_components_tests.rs b/crates/openhuman-core/src/modules/ops_components_tests.rs
index becf15aa42..e483896c4e 100644
--- a/crates/openhuman-core/src/modules/ops_components_tests.rs
+++ b/crates/openhuman-core/src/modules/ops_components_tests.rs
@@ -85,3 +85,18 @@ async fn juice_off_refuses_tinyjuice_before_download_or_load() {
assert_eq!(status.state, ModuleState::Disabled);
assert!(status.source.is_none());
}
+
+#[cfg(feature = "voice")]
+#[tokio::test]
+async fn voice_off_refuses_tinyvoice_before_download_or_load() {
+ let config = config_without("voice");
+ let err = ensure_loaded_within(&config, "tinyvoice", None)
+ .await
+ .unwrap_err();
+ assert_eq!(err, LoadError::Disabled("voice"));
+ assert_eq!(err.into_message(), "COMPONENT_DISABLED:voice");
+ let statuses = list(&config);
+ let status = statuses.iter().find(|s| s.id == "tinyvoice").unwrap();
+ assert_eq!(status.state, ModuleState::Disabled);
+ assert!(status.source.is_none());
+}
diff --git a/crates/openhuman-core/src/voice/always_on_tests.rs b/crates/openhuman-core/src/voice/always_on_tests.rs
index 0cf3d65baa..7e851573fd 100644
--- a/crates/openhuman-core/src/voice/always_on_tests.rs
+++ b/crates/openhuman-core/src/voice/always_on_tests.rs
@@ -59,3 +59,13 @@ async fn an_utterance_started_after_stop_never_polls_its_transcription() {
tasks.join_next().await.unwrap().unwrap();
assert!(!delivered.load(Ordering::SeqCst));
}
+
+#[tokio::test]
+async fn voice_component_off_keeps_always_on_down_even_when_enabled() {
+ use std::sync::atomic::Ordering;
+ let mut config = crate::config::Config::default();
+ config.voice_server.always_on_enabled = true;
+ config.components.voice = false;
+ super::processor::start_if_enabled(&config).await;
+ assert!(!super::processor::ENABLED.load(Ordering::SeqCst));
+}
diff --git a/crates/openhuman-core/src/voice/dictation_listener_tests.rs b/crates/openhuman-core/src/voice/dictation_listener_tests.rs
index 659935235f..7bdbc4b565 100644
--- a/crates/openhuman-core/src/voice/dictation_listener_tests.rs
+++ b/crates/openhuman-core/src/voice/dictation_listener_tests.rs
@@ -149,3 +149,16 @@ fn normalize_trims_whitespace_between_segments() {
let result = normalize_hotkey(" cmd + shift + d ");
assert_eq!(result, "cmd+shift+d");
}
+
+#[tokio::test]
+async fn voice_component_off_overrides_dictation_enabled() {
+ let mut config = Config::default();
+ config.dictation.enabled = true;
+ config.dictation.hotkey = "ctrl+space".into();
+ config.components.voice = false;
+ start_if_enabled(&config).await;
+ assert!(
+ LISTENER_HANDLE.lock().expect("lock").is_none(),
+ "no hotkey listener while [components].voice is off"
+ );
+}