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

Function test_validate_branch_parent

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

Source from the content-addressed store, hash-verified

1003
1004 #[test]
1005 fn test_validate_branch_parent() {
1006 let mut txn = MockTxn::new();
1007 let mut context = ApplyContext::new(ApplyOptions::default());
1008 let trunk_id = create_test_trunk(&mut txn, 1);
1009 let branch_id = BranchId::new(NodeId::new(1), 0);
1010
1011 // Create a branch
1012 let insert_op = BranchOp::Insert {
1013 after: None,
1014 content: vec![],
1015 };
1016 apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &insert_op, &[]).unwrap();
1017
1018 // Should pass for correct trunk
1019 validate_branch_parent(&txn, branch_id, trunk_id).unwrap();
1020
1021 // Should fail for wrong trunk
1022 let wrong_trunk = TrunkId::new(NodeId::new(99), 0);
1023 let result = validate_branch_parent(&txn, branch_id, wrong_trunk);
1024 assert!(result.is_err());
1025 }
1026}

Callers

nothing calls this directly

Calls 4

create_test_trunkFunction · 0.85
apply_branch_opFunction · 0.85
validate_branch_parentFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected