MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_watcher_multiple_turns

Function test_watcher_multiple_turns

atomic-agent/src/watcher/fallback.rs:768–798  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

766
767 #[tokio::test]
768 async fn test_watcher_multiple_turns() {
769 let dir = TempDir::new().unwrap();
770
771 let mut watcher = FallbackWatcher::new(make_config(&dir));
772
773 // Turn 1: add a file
774 watcher.begin_turn("sess-1").await.unwrap();
775 fs::write(dir.path().join("turn1.rs"), "turn 1").unwrap();
776 let changes = watcher.end_turn().await.unwrap();
777 assert_eq!(changes.added, vec![PathBuf::from("turn1.rs")]);
778
779 // Turn 2: add another file
780 watcher.begin_turn("sess-1").await.unwrap();
781 fs::write(dir.path().join("turn2.rs"), "turn 2").unwrap();
782 let changes = watcher.end_turn().await.unwrap();
783 // Should only see turn2.rs, not turn1.rs (which existed before this turn)
784 assert_eq!(changes.added, vec![PathBuf::from("turn2.rs")]);
785 assert!(changes.modified.is_empty());
786
787 // Turn 3: modify turn1.rs
788 watcher.begin_turn("sess-1").await.unwrap();
789 std::thread::sleep(std::time::Duration::from_millis(50));
790 fs::write(
791 dir.path().join("turn1.rs"),
792 "turn 1 modified with more content",
793 )
794 .unwrap();
795 let changes = watcher.end_turn().await.unwrap();
796 assert_eq!(changes.modified, vec![PathBuf::from("turn1.rs")]);
797 assert!(changes.added.is_empty());
798 }
799
800 #[tokio::test]
801 async fn test_watcher_begin_turn_overwrites_previous() {

Callers

nothing calls this directly

Calls 6

make_configFunction · 0.85
writeFunction · 0.85
unwrapMethod · 0.45
begin_turnMethod · 0.45
pathMethod · 0.45
end_turnMethod · 0.45

Tested by

no test coverage detected