()
| 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() { |
nothing calls this directly
no test coverage detected