From fb6152e975f4c98b339bc162d8bbf0f2c63f0415 Mon Sep 17 00:00:00 2001 From: CLAI QA Date: Thu, 21 May 2026 23:52:49 +0200 Subject: [PATCH] test(config): cover Git skill source with no local_path diagnostic Adds a single unit test in src-tauri/src/config/mod.rs covering the "Source has no local path yet" diagnostic branch in discover_skills_with_diagnostics. This was the only remaining uncovered branch flagged in the PR #11 review (minor finding). The test builds a ClaiConfig with one enabled Git skill source whose local_path is None (the state right after the user adds a Git source but before the clone completes) and asserts the resulting diagnostic has ok == false and message contains "no local path yet". --- src-tauri/src/config/mod.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src-tauri/src/config/mod.rs b/src-tauri/src/config/mod.rs index c8399ea..9a58a61 100644 --- a/src-tauri/src/config/mod.rs +++ b/src-tauri/src/config/mod.rs @@ -799,6 +799,30 @@ mod tests { ); } + #[test] + fn discover_skills_emits_no_local_path_diagnostic_for_git_source() { + // Enabled Git skill source whose clone has not produced a local_path + // yet must surface an actionable diagnostic asking the user to refresh. + let mut config = ClaiConfig::default(); + config.skill_sources.push(SkillSourceConfig::new_git( + "Awaiting clone".to_string(), + "https://example.invalid/skills.git".to_string(), + None, + None, + )); + + let (skills, diagnostics) = discover_skills_with_diagnostics(&config); + assert!(skills.is_empty()); + assert_eq!(diagnostics.len(), 1); + assert!(!diagnostics[0].ok); + assert_eq!(diagnostics[0].skill_count, 0); + assert!(diagnostics[0] + .message + .as_deref() + .unwrap_or("") + .contains("no local path yet")); + } + #[test] fn discover_skills_emits_missing_path_diagnostic() { let mut config = ClaiConfig::default();