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

Function test_apply_delete

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

Source from the content-addressed store, hash-verified

629
630 #[test]
631 fn test_apply_delete() {
632 let mut txn = MockTxn::new();
633 let mut context = ApplyContext::new(ApplyOptions::default());
634 let trunk_id = TrunkId::new(NodeId::new(1), 0);
635
636 // Create first
637 let create_op = TrunkOp::Create {
638 path: "test.rs".to_string(),
639 encoding: None,
640 };
641 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
642
643 // Delete
644 let delete_op = TrunkOp::Delete { trunk: trunk_id };
645 apply_trunk_op(&mut txn, &mut context, trunk_id, &delete_op).unwrap();
646
647 let trunk = txn.get_trunk(trunk_id).unwrap().unwrap();
648 assert!(trunk.state().is_deleted());
649 assert_eq!(context.stats().trunks_deleted(), 1);
650 }
651
652 #[test]
653 fn test_apply_delete_not_found() {

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