mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-28 13:32:23 +00:00
test(coverage): batch 5–8 — Rust unit tests toward 80% for 20 modules (#607)
* test(coverage): batch 5–8 — Rust unit tests toward 80% for 20 modules (#530) Add 244 new unit tests across 20 modules to push line coverage from 75.06% → 75.70% overall. Modules improved: - api/socket: 77% → 100% - rpc/dispatch: 75% → 100% - config/schema/channels: 77% → 100% - composio/gmail/sync: 78% → 97% - composio/notion/sync: 77% → 96% - webhooks/router: 78% → 96% - agent/hooks: 78% → 92% - config/schema/proxy: 76% → 90% - local_ai/device: 79% → 89% - text_input/schemas: 73% → 89% - agent/harness/interrupt: 76% → 88% - billing/schemas: 79% → 87% - screen_intelligence/schemas: 78% → 81% - about_app/types, health/schemas, app_state/schemas, core/types, config/schema/identity_cost, cron/scheduler Tests cover: schema catalog integrity, param deserialization, serde roundtrips, helper functions, edge cases, error paths. All 3974 tests pass. * test(coverage): batch 9–10 — browser_open, update_memory_md, credentials profiles, cost tracker (#530) Add 53 new tests across 4 more modules: - browser_open: IPv4/IPv6 private ranges, host matching, normalize_domain edges - update_memory_md: empty file, section creation, unknown action, param validation - credentials/profiles: token expiry, CRUD operations, active profile management - cost/tracker: budget warnings, monthly exceeded, model stats aggregation All 4027 tests pass. * test(coverage): batch 11–12 — channels schemas, conversation store (#530) Add 33 new tests: - channels/controllers/schemas: per-function input validation, param deserialization, helper coverage - memory/conversations/store: thread lifecycle (create, delete, idempotent), multi-thread, empty/nonexistent thread, purge empty store All 4060 tests pass.
This commit is contained in:
@@ -12,3 +12,53 @@ pub fn websocket_url(http_or_https_base: &str) -> String {
|
||||
};
|
||||
format!("{}/socket.io/?EIO=4&transport=websocket", ws_base)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn converts_https_to_wss() {
|
||||
let url = websocket_url("https://api.tinyhumans.ai");
|
||||
assert_eq!(
|
||||
url,
|
||||
"wss://api.tinyhumans.ai/socket.io/?EIO=4&transport=websocket"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn converts_http_to_ws() {
|
||||
let url = websocket_url("http://localhost:3000");
|
||||
assert_eq!(
|
||||
url,
|
||||
"ws://localhost:3000/socket.io/?EIO=4&transport=websocket"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn passes_through_unknown_scheme() {
|
||||
let url = websocket_url("ftp://example.com");
|
||||
assert_eq!(
|
||||
url,
|
||||
"ftp://example.com/socket.io/?EIO=4&transport=websocket"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strips_trailing_slash() {
|
||||
let url = websocket_url("https://api.tinyhumans.ai/");
|
||||
assert_eq!(
|
||||
url,
|
||||
"wss://api.tinyhumans.ai/socket.io/?EIO=4&transport=websocket"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strips_multiple_trailing_slashes() {
|
||||
let url = websocket_url("https://api.tinyhumans.ai///");
|
||||
assert_eq!(
|
||||
url,
|
||||
"wss://api.tinyhumans.ai/socket.io/?EIO=4&transport=websocket"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user