niom-webrtc/tests/config_tests.rs

18 lines
628 B
Rust

use niom_webrtc::constants::DEFAULT_STUN_SERVER;
use niom_webrtc::config::Config;
#[test]
fn default_stun_server_present() {
assert!(DEFAULT_STUN_SERVER.contains("stun:"));
}
#[test]
fn config_from_file_roundtrip() {
// Create a temporary JSON in /tmp and read it via Config::from_file
let tmp = tempfile::NamedTempFile::new().expect("tempfile");
let cfg_json = r#"{ "server": { "stun_server": "stun:example.org:3478" } }"#;
std::fs::write(tmp.path(), cfg_json).expect("write");
let cfg = Config::from_file(tmp.path()).expect("load");
assert_eq!(cfg.server.stun_server, "stun:example.org:3478");
}