use super::super::*;
#[test]
fn test_generate_default_config() {
let config_str = generate_default_config();
assert!(config_str.starts_with(
"#:schema https://raw.githubusercontent.com/eitsupi/arf/main/artifacts/arf.schema.json"
));
let parsed: Config =
toml::from_str(&config_str).expect("Generated config should be valid TOML");
assert!(matches!(
parsed.startup.r_source,
RSource::Mode(RSourceMode::Auto)
));
assert!(parsed.startup.show_banner);
assert_eq!(parsed.editor.mode, EditorMode::Emacs);
assert_eq!(parsed.experimental.r_help.viewer, HelpViewer::R);
}
#[test]
fn test_generate_default_config_has_new_structure() {
let config_str = generate_default_config();
assert!(
config_str.contains("[startup]"),
"Should have [startup] section"
);
assert!(
config_str.contains("r_source = "),
"Should have r_source in startup section"
);
assert!(
config_str.contains("show_banner = "),
"Should have show_banner in startup section"
);
assert!(
config_str.contains(r#"reprex = "off""#),
"Should have reprex mode in startup section"
);
assert!(
config_str.contains("[reprex]"),
"Should have [reprex] section"
);
assert!(
!config_str.contains("[general]"),
"Should NOT have [general] section"
);
assert!(
!config_str.contains("[shortcuts]"),
"Should NOT have [shortcuts] section"
);
assert!(
!config_str.contains("[formatter]"),
"Should NOT have [formatter] section"
);
assert!(
config_str.contains("[editor]"),
"Should have [editor] section"
);
assert!(
config_str.contains(r#"mode = "persistent""#),
"History should default to persistent mode"
);
assert!(
!config_str.contains("disabled"),
"Deprecated history.disabled must not be serialized"
);
}