()
| 685 | |
| 686 | #[test] |
| 687 | fn test_apply_insert_duplicate_id() { |
| 688 | let mut txn = MockTxn::new(); |
| 689 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 690 | let branch_id = create_test_branch(&mut txn, 1, 0); |
| 691 | let leaf_id = LeafId::new(NodeId::new(1), 0); |
| 692 | |
| 693 | let op = LeafOp::Insert { |
| 694 | after: None, |
| 695 | kind: TokenKind::Word, |
| 696 | content: b"hello".to_vec(), |
| 697 | }; |
| 698 | |
| 699 | apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &op, b"hello").unwrap(); |
| 700 | |
| 701 | // Try to insert again with same ID |
| 702 | let result = apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &op, b"hello"); |
| 703 | assert!(result.is_err()); |
| 704 | assert!(result.unwrap_err().is_already_exists()); |
| 705 | } |
| 706 | |
| 707 | #[test] |
| 708 | fn test_apply_insert_duplicate_id_lenient() { |
nothing calls this directly
no test coverage detected