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

Source from the content-addressed store, hash-verified

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