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

Function test_save_new_file

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

Source from the content-addressed store, hash-verified

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