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

Function test_apply_undelete

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

Source from the content-addressed store, hash-verified

792
793 #[test]
794 fn test_apply_undelete() {
795 let mut txn = MockTxn::new();
796 let mut context = ApplyContext::new(ApplyOptions::default());
797 let trunk_id = TrunkId::new(NodeId::new(1), 0);
798
799 // Create and delete
800 let create_op = TrunkOp::Create {
801 path: "test.rs".to_string(),
802 encoding: None,
803 };
804 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
805
806 let delete_op = TrunkOp::Delete { trunk: trunk_id };
807 apply_trunk_op(&mut txn, &mut context, trunk_id, &delete_op).unwrap();
808
809 // Undelete
810 let undelete_op = TrunkOp::Undelete { trunk: trunk_id };
811 apply_trunk_op(&mut txn, &mut context, trunk_id, &undelete_op).unwrap();
812
813 let trunk = txn.get_trunk(trunk_id).unwrap().unwrap();
814 assert!(trunk.state().is_alive());
815 assert_eq!(context.stats().trunks_undeleted(), 1);
816 }
817
818 #[test]
819 fn test_apply_undelete_not_deleted() {

Callers

nothing calls this directly

Calls 3

apply_trunk_opFunction · 0.70
unwrapMethod · 0.45
get_trunkMethod · 0.45

Tested by

no test coverage detected