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

Function test_save_new_file

atomic-agent/src/learnings.rs:989–1012  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

987
988 #[test]
989 fn test_save_new_file() {
990 let dir = TempDir::new().unwrap();
991 let learnings = Learnings {
992 repo: vec!["Pattern A".into()],
993 code: vec![CodeLearning::new("f.rs", Some(1), "Finding B")],
994 workflow: vec!["Tip C".into()],
995 };
996
997 let result = save_learnings_to_context_file(dir.path(), "claude-code", &learnings).unwrap();
998
999 assert_eq!(result.added, 2); // repo + workflow only, code excluded
1000 assert_eq!(result.skipped_duplicates, 0);
1001 assert!(result.has_changes());
1002
1003 // Verify file was created
1004 let content = std::fs::read_to_string(dir.path().join("CLAUDE.md")).unwrap();
1005 assert!(content.contains(SECTION_HEADING));
1006 assert!(content.contains(SECTION_START));
1007 assert!(content.contains("- Pattern A"));
1008 assert!(!content.contains("Finding B")); // code learning excluded
1009 assert!(!content.contains("f.rs")); // code learning excluded
1010 assert!(content.contains("- Tip C"));
1011 assert!(content.contains(SECTION_END));
1012 }
1013
1014 #[test]
1015 fn test_save_append_to_existing_file() {

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected