nika_engine/secrets/
result.rs1#[derive(Debug, Clone, Default)]
5pub struct SecretsLoadResult {
6 pub from_env: Vec<String>,
8 pub not_found: Vec<String>,
10}
11
12impl SecretsLoadResult {
13 pub fn total_loaded(&self) -> usize {
15 self.from_env.len()
16 }
17
18 pub fn summary(&self) -> String {
20 format!(
21 "{} from env, {} not found",
22 self.from_env.len(),
23 self.not_found.len()
24 )
25 }
26}
27
28#[cfg(test)]
29mod tests {
30 use super::*;
31
32 #[test]
33 fn test_secrets_load_result_summary() {
34 let result = SecretsLoadResult {
35 from_env: vec!["anthropic".into(), "openai".into()],
36 not_found: vec!["groq".into()],
37 };
38 assert_eq!(result.total_loaded(), 2);
39 assert!(result.summary().contains("2 from env"));
40 }
41
42 #[test]
43 fn test_secrets_load_result_empty() {
44 let result = SecretsLoadResult {
45 from_env: vec![],
46 not_found: vec!["anthropic".into()],
47 };
48 assert_eq!(result.total_loaded(), 0);
49 assert!(result.summary().contains("0 from env"));
50 }
51}