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:1655–1689  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1653
1654 #[test]
1655 fn test_vault_list_and_delete() {
1656 let dir = tempdir().unwrap();
1657 let repo = Repository::init(dir.path()).unwrap();
1658 repo.init_vault().unwrap();
1659
1660 repo.vault_store(
1661 "memory/arch.md",
1662 VaultEntryType::Memory,
1663 b"content1".to_vec(),
1664 "{}".to_string(),
1665 )
1666 .unwrap();
1667 repo.vault_store(
1668 "goals/abc/_goal.md",
1669 VaultEntryType::Session,
1670 b"content2".to_vec(),
1671 "{}".to_string(),
1672 )
1673 .unwrap();
1674
1675 // List all (4 defaults from init_vault + 2 test entries)
1676 let all = repo.vault_list("", None).unwrap();
1677 assert_eq!(all.len(), 6);
1678
1679 // Filter by type
1680 let sessions = repo.vault_list("", Some(VaultEntryType::Session)).unwrap();
1681 assert_eq!(sessions.len(), 1);
1682
1683 // Delete
1684 assert!(repo.vault_delete("memory/arch.md").unwrap());
1685 assert!(!repo.vault_delete("memory/arch.md").unwrap());
1686
1687 let all = repo.vault_list("", None).unwrap();
1688 assert_eq!(all.len(), 5);
1689 }
1690
1691 #[test]
1692 fn test_vault_delete_cleans_embeddings() {

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