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

Function test_save_code_learnings_excluded

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

Source from the content-addressed store, hash-verified

1154
1155 #[test]
1156 fn test_save_code_learnings_excluded() {
1157 let dir = TempDir::new().unwrap();
1158
1159 // Learnings with code — code should NOT appear in the file
1160 let learnings = Learnings {
1161 repo: vec!["Repo item".into()],
1162 code: vec![CodeLearning::new("f.rs", Some(42), "Code finding")],
1163 workflow: vec![],
1164 };
1165
1166 let result = save_learnings_to_context_file(dir.path(), "claude-code", &learnings).unwrap();
1167
1168 // Only 1 added (the repo item), not 2
1169 assert_eq!(result.added, 1);
1170
1171 let content = std::fs::read_to_string(dir.path().join("CLAUDE.md")).unwrap();
1172 assert!(content.contains("- Repo item"));
1173 assert!(!content.contains("Code finding"));
1174 assert!(!content.contains("### Code"));
1175 assert!(!content.contains("f.rs"));
1176 }
1177
1178 #[test]
1179 fn test_save_empty_learnings() {

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected