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

Function test_content_cache_reuses_reads

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

Source from the content-addressed store, hash-verified

198
199#[test]
200fn test_content_cache_reuses_reads() {
201 let temp = TempDir::new().unwrap();
202 let project_root = temp.path();
203
204 fs::write(
205 project_root.join("package.json"),
206 r#"{"dependencies": {"react": "^18.0.0"}}"#,
207 )
208 .unwrap();
209
210 let detector = catalog_detector();
211 let mut cache = ContentCache::new();
212
213 // First detection
214 let detections1 = detector.detect(project_root, &mut cache).unwrap();
215
216 // Cache should now contain package.json
217 assert!(!cache.is_empty(), "Cache should contain read files");
218
219 // Second detection should reuse cache
220 let detections2 = detector.detect(project_root, &mut cache).unwrap();
221
222 assert_eq!(
223 detections1.len(),
224 detections2.len(),
225 "Should get same results from cache"
226 );
227}
228
229#[test]
230fn test_detect_with_empty_project() {

Callers

nothing calls this directly

Calls 2

catalog_detectorFunction · 0.70
detectMethod · 0.45

Tested by

no test coverage detected