20 lines
752 B
Rust
20 lines
752 B
Rust
use niom_webrtc::config::load_config_sync_or_default;
|
|
use std::fs;
|
|
|
|
#[test]
|
|
fn sync_loader_returns_default_when_no_file() {
|
|
// Ensure there's no appsettings.json in CWD for this test
|
|
let _ = fs::remove_file("appsettings.json");
|
|
let cfg = load_config_sync_or_default();
|
|
assert_eq!(cfg.server.stun_server, niom_webrtc::constants::DEFAULT_STUN_SERVER.to_string());
|
|
}
|
|
|
|
// This test ensures the function compiles and returns a Config; on native it will use the file-path,
|
|
// on wasm it would read the HTML-injection. We call it to assert the API surface.
|
|
#[test]
|
|
fn sync_loader_api_callable() {
|
|
let cfg = load_config_sync_or_default();
|
|
// At minimum we have a non-empty stun_server
|
|
assert!(!cfg.server.stun_server.is_empty());
|
|
}
|