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

Function test_apply_insert

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

Source from the content-addressed store, hash-verified

688
689 #[test]
690 fn test_apply_insert() {
691 let mut txn = MockTxn::new();
692 let mut context = ApplyContext::new(ApplyOptions::default());
693 let trunk_id = create_test_trunk(&mut txn, 1);
694 let branch_id = BranchId::new(NodeId::new(1), 0);
695
696 let op = BranchOp::Insert {
697 after: None,
698 content: vec![],
699 };
700
701 apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &op, &[]).unwrap();
702
703 assert!(txn.has_branch(branch_id).unwrap());
704 let branch = txn.get_branch(branch_id).unwrap().unwrap();
705 assert_eq!(branch.trunk(), trunk_id);
706 assert!(branch.state().is_alive());
707 assert_eq!(context.stats().branches_inserted(), 1);
708 }
709
710 #[test]
711 fn test_apply_insert_after() {

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