use super::*;
#[test]
fn client_region_allowlist_parses_when_present() {
let file: FileConfig = toml::from_str(
r#"
[client]
region_allowlist = ["US", "DE"]
"#,
)
.expect("valid [client] table parses");
assert_eq!(
file.client
.expect("[client] present")
.region_allowlist
.expect("region_allowlist present"),
vec!["US".to_string(), "DE".to_string()]
);
}
#[test]
fn client_section_absent_by_default() {
let file: FileConfig = toml::from_str("").expect("empty config parses");
assert!(file.client.is_none());
}
#[test]
fn self_update_check_parses_when_present() {
let file: FileConfig = toml::from_str(
r"
[self_update]
check = false
",
)
.expect("valid [self_update] table parses");
assert_eq!(
file.self_update.expect("[self_update] present").check,
Some(false)
);
}
#[test]
fn self_update_section_absent_by_default() {
let file: FileConfig = toml::from_str("").expect("empty config parses");
assert!(file.self_update.is_none());
}
#[test]
fn self_update_rejects_unknown_keys() {
let err = toml::from_str::<FileConfig>(
r"
[self_update]
auto = true
",
)
.expect_err("unknown key is refused");
assert!(err.to_string().contains("auto"), "{err}");
}