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

Function test_apply_delete_already_deleted

atomic-core/src/crdt/apply/leaf.rs:794–823  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

792
793 #[test]
794 fn test_apply_delete_already_deleted() {
795 let mut txn = MockTxn::new();
796 let mut context = ApplyContext::new(ApplyOptions::default());
797 let branch_id = create_test_branch(&mut txn, 1, 0);
798 let leaf_id = LeafId::new(NodeId::new(1), 0);
799
800 // Create and delete
801 let insert_op = LeafOp::Insert {
802 after: None,
803 kind: TokenKind::Word,
804 content: b"hello".to_vec(),
805 };
806 apply_leaf_op(
807 &mut txn,
808 &mut context,
809 branch_id,
810 leaf_id,
811 &insert_op,
812 b"hello",
813 )
814 .unwrap();
815
816 let delete_op = LeafOp::Delete { leaf: leaf_id };
817 apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &delete_op, &[]).unwrap();
818
819 // Try to delete again
820 let result = apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &delete_op, &[]);
821 assert!(result.is_err());
822 assert!(result.unwrap_err().is_invalid_state());
823 }
824
825 // Replace Tests
826

Callers

nothing calls this directly

Calls 3

create_test_branchFunction · 0.85
apply_leaf_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected