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:855–874  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

853
854 #[test]
855 fn test_validate_trunk_state() {
856 let mut txn = MockTxn::new();
857 let mut context = ApplyContext::new(ApplyOptions::default());
858 let trunk_id = TrunkId::new(NodeId::new(1), 0);
859
860 // Create a trunk
861 let create_op = TrunkOp::Create {
862 path: "test.rs".to_string(),
863 encoding: None,
864 };
865 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
866
867 // Validate alive state
868 let trunk = validate_trunk_state(&txn, trunk_id, Some(TrunkState::Alive)).unwrap();
869 assert!(trunk.state().is_alive());
870
871 // Should fail for deleted state
872 let result = validate_trunk_state(&txn, trunk_id, Some(TrunkState::Deleted));
873 assert!(result.is_err());
874 }
875
876 #[test]
877 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