test: Added tests for new config command

This commit is contained in:
2025-09-15 09:47:31 -06:00
parent dbb4d265c4
commit e8de47dc52
2 changed files with 90 additions and 1 deletions
+22 -1
View File
@@ -1,6 +1,6 @@
#[cfg(test)]
mod tests {
use gman::config::{Config, ProviderConfig, RunConfig};
use gman::config::{Config, ProviderConfig, RunConfig};
use pretty_assertions::assert_eq;
use validator::Validate;
@@ -252,4 +252,25 @@ mod tests {
assert_eq!(path, None);
}
}
#[test]
fn test_config_duplicate_provider_names_is_invalid() {
let name = Some("dup".into());
let p1 = ProviderConfig {
name: name.clone(),
..Default::default()
};
let p2 = ProviderConfig {
name,
..Default::default()
};
let cfg = Config {
default_provider: Some("dup".into()),
providers: vec![p1, p2],
run_configs: None,
};
assert!(cfg.validate().is_err());
}
}