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

Function test_apply_insert_duplicate_id

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

Source from the content-addressed store, hash-verified

737
738 #[test]
739 fn test_apply_insert_duplicate_id() {
740 let mut txn = MockTxn::new();
741 let mut context = ApplyContext::new(ApplyOptions::default());
742 let trunk_id = create_test_trunk(&mut txn, 1);
743 let branch_id = BranchId::new(NodeId::new(1), 0);
744
745 let op = BranchOp::Insert {
746 after: None,
747 content: vec![],
748 };
749
750 apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &op, &[]).unwrap();
751
752 // Try to insert again with same ID
753 let result = apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &op, &[]);
754 assert!(result.is_err());
755 assert!(result.unwrap_err().is_already_exists());
756 }
757
758 #[test]
759 fn test_apply_insert_duplicate_id_lenient() {

Callers

nothing calls this directly

Calls 3

create_test_trunkFunction · 0.85
apply_branch_opFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected