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

Function test_validate_trunk_state

atomic-core/src/crdt/apply/trunk.rs:862–881  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

860
861 #[test]
862 fn test_validate_trunk_state() {
863 let mut txn = MockTxn::new();
864 let mut context = ApplyContext::new(ApplyOptions::default());
865 let trunk_id = TrunkId::new(NodeId::new(1), 0);
866
867 // Create a trunk
868 let create_op = TrunkOp::Create {
869 path: "test.rs".to_string(),
870 encoding: None,
871 };
872 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
873
874 // Validate alive state
875 let trunk = validate_trunk_state(&txn, trunk_id, Some(TrunkState::Alive)).unwrap();
876 assert!(trunk.state().is_alive());
877
878 // Should fail for deleted state
879 let result = validate_trunk_state(&txn, trunk_id, Some(TrunkState::Deleted));
880 assert!(result.is_err());
881 }
882
883 #[test]
884 fn test_validate_path_available() {

Callers

nothing calls this directly

Calls 3

validate_trunk_stateFunction · 0.85
apply_trunk_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected