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

Function test_apply_delete

atomic-core/src/crdt/apply/branch.rs:829–852  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

827
828 #[test]
829 fn test_apply_delete() {
830 let mut txn = MockTxn::new();
831 let mut context = ApplyContext::new(ApplyOptions::default());
832 let trunk_id = create_test_trunk(&mut txn, 1);
833 let branch_id = BranchId::new(NodeId::new(1), 0);
834
835 // Create first
836 let insert_op = BranchOp::Insert {
837 after: None,
838 content: vec![],
839 };
840 apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &insert_op, &[]).unwrap();
841
842 // Delete
843 let delete_op = BranchOp::Delete {
844 branch: branch_id,
845 content: vec![],
846 };
847 apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &delete_op, &[]).unwrap();
848
849 let branch = txn.get_branch(branch_id).unwrap().unwrap();
850 assert!(branch.state().is_deleted());
851 assert_eq!(context.stats().branches_deleted(), 1);
852 }
853
854 #[test]
855 fn test_apply_delete_not_found() {

Callers

nothing calls this directly

Calls 4

create_test_trunkFunction · 0.85
apply_branch_opFunction · 0.85
unwrapMethod · 0.45
get_branchMethod · 0.45

Tested by

no test coverage detected