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

Function test_vault_list_and_delete

atomic-repository/src/repository/vault.rs:1178–1212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1176
1177 #[test]
1178 fn test_vault_list_and_delete() {
1179 let dir = tempdir().unwrap();
1180 let repo = Repository::init(dir.path()).unwrap();
1181 repo.init_vault().unwrap();
1182
1183 repo.vault_store(
1184 "memory/arch.md",
1185 VaultEntryType::Memory,
1186 b"content1".to_vec(),
1187 "{}".to_string(),
1188 )
1189 .unwrap();
1190 repo.vault_store(
1191 "goals/abc/_goal.md",
1192 VaultEntryType::Session,
1193 b"content2".to_vec(),
1194 "{}".to_string(),
1195 )
1196 .unwrap();
1197
1198 // List all (4 defaults from init_vault + 2 test entries)
1199 let all = repo.vault_list("", None).unwrap();
1200 assert_eq!(all.len(), 6);
1201
1202 // Filter by type
1203 let sessions = repo.vault_list("", Some(VaultEntryType::Session)).unwrap();
1204 assert_eq!(sessions.len(), 1);
1205
1206 // Delete
1207 assert!(repo.vault_delete("memory/arch.md").unwrap());
1208 assert!(!repo.vault_delete("memory/arch.md").unwrap());
1209
1210 let all = repo.vault_list("", None).unwrap();
1211 assert_eq!(all.len(), 5);
1212 }
1213
1214 #[test]
1215 fn test_vault_manifest() {

Callers

nothing calls this directly

Calls 5

vault_storeMethod · 0.80
vault_listMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
init_vaultMethod · 0.45

Tested by

no test coverage detected