MCPcopy Create free account
hub / github.com/dallay/agentsync / test_detect_ignores_node_modules_and_git

Function test_detect_ignores_node_modules_and_git

tests/unit/detect_coverage.rs:167–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165
166#[test]
167fn test_detect_ignores_node_modules_and_git() {
168 let temp = TempDir::new().unwrap();
169 let project_root = temp.path();
170
171 // Create directories that should be ignored (line 126 coverage)
172 fs::create_dir_all(project_root.join("node_modules")).unwrap();
173 fs::create_dir_all(project_root.join(".git")).unwrap();
174 fs::create_dir_all(project_root.join("target")).unwrap();
175 fs::create_dir_all(project_root.join("src")).unwrap();
176
177 fs::write(project_root.join("src/main.rs"), "fn main() {}").unwrap();
178 fs::write(project_root.join("node_modules/test.js"), "test").unwrap();
179 fs::write(
180 project_root.join("Cargo.toml"),
181 "[package]\nname = \"test\"",
182 )
183 .unwrap();
184
185 let detector = catalog_detector();
186 let mut cache = ContentCache::new();
187 let detections = detector.detect(project_root, &mut cache).unwrap();
188
189 let tech_ids: Vec<_> = detections
190 .iter()
191 .map(|d| d.technology.as_ref().to_string())
192 .collect();
193 assert!(tech_ids.contains(&"rust".to_string()), "Should detect Rust");
194
195 // The detector should not have scanned node_modules or .git
196 // (we can't directly test this, but the test exercises the ignore logic)
197}
198
199#[test]
200fn test_content_cache_reuses_reads() {

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
as_refMethod · 0.80
catalog_detectorFunction · 0.70
detectMethod · 0.45

Tested by

no test coverage detected