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

Function test_apply_delete

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

Source from the content-addressed store, hash-verified

622
623 #[test]
624 fn test_apply_delete() {
625 let mut txn = MockTxn::new();
626 let mut context = ApplyContext::new(ApplyOptions::default());
627 let trunk_id = TrunkId::new(NodeId::new(1), 0);
628
629 // Create first
630 let create_op = TrunkOp::Create {
631 path: "test.rs".to_string(),
632 encoding: None,
633 };
634 apply_trunk_op(&mut txn, &mut context, trunk_id, &create_op).unwrap();
635
636 // Delete
637 let delete_op = TrunkOp::Delete { trunk: trunk_id };
638 apply_trunk_op(&mut txn, &mut context, trunk_id, &delete_op).unwrap();
639
640 let trunk = txn.get_trunk(trunk_id).unwrap().unwrap();
641 assert!(trunk.state().is_deleted());
642 assert_eq!(context.stats().trunks_deleted(), 1);
643 }
644
645 #[test]
646 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