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

Function test_validate_branch_state

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

Source from the content-addressed store, hash-verified

980
981 #[test]
982 fn test_validate_branch_state() {
983 let mut txn = MockTxn::new();
984 let mut context = ApplyContext::new(ApplyOptions::default());
985 let trunk_id = create_test_trunk(&mut txn, 1);
986 let branch_id = BranchId::new(NodeId::new(1), 0);
987
988 // Create a branch
989 let insert_op = BranchOp::Insert {
990 after: None,
991 content: vec![],
992 };
993 apply_branch_op(&mut txn, &mut context, trunk_id, branch_id, &insert_op, &[]).unwrap();
994
995 // Validate alive state
996 let branch = validate_branch_state(&txn, branch_id, Some(BranchState::Alive)).unwrap();
997 assert!(branch.state().is_alive());
998
999 // Should fail for deleted state
1000 let result = validate_branch_state(&txn, branch_id, Some(BranchState::Deleted));
1001 assert!(result.is_err());
1002 }
1003
1004 #[test]
1005 fn test_validate_branch_parent() {

Callers

nothing calls this directly

Calls 4

create_test_trunkFunction · 0.85
apply_branch_opFunction · 0.85
validate_branch_stateFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected