()
| 709 | |
| 710 | #[test] |
| 711 | fn test_apply_insert_after() { |
| 712 | let mut txn = MockTxn::new(); |
| 713 | let mut context = ApplyContext::new(ApplyOptions::default()); |
| 714 | let trunk_id = create_test_trunk(&mut txn, 1); |
| 715 | |
| 716 | let branch_id1 = BranchId::new(NodeId::new(1), 0); |
| 717 | let branch_id2 = BranchId::new(NodeId::new(1), 1); |
| 718 | |
| 719 | // Insert first branch |
| 720 | let op1 = BranchOp::Insert { |
| 721 | after: None, |
| 722 | content: vec![], |
| 723 | }; |
| 724 | apply_branch_op(&mut txn, &mut context, trunk_id, branch_id1, &op1, &[]).unwrap(); |
| 725 | |
| 726 | // Insert second branch after first |
| 727 | let op2 = BranchOp::Insert { |
| 728 | after: Some(branch_id1), |
| 729 | content: vec![], |
| 730 | }; |
| 731 | apply_branch_op(&mut txn, &mut context, trunk_id, branch_id2, &op2, &[]).unwrap(); |
| 732 | |
| 733 | assert!(txn.has_branch(branch_id1).unwrap()); |
| 734 | assert!(txn.has_branch(branch_id2).unwrap()); |
| 735 | assert_eq!(context.stats().branches_inserted(), 2); |
| 736 | } |
| 737 | |
| 738 | #[test] |
| 739 | fn test_apply_insert_duplicate_id() { |
nothing calls this directly
no test coverage detected