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

Function test_apply_restore_not_deleted

atomic-core/src/crdt/apply/leaf.rs:970–998  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

968
969 #[test]
970 fn test_apply_restore_not_deleted() {
971 let mut txn = MockTxn::new();
972 let mut context = ApplyContext::new(ApplyOptions::default());
973 let branch_id = create_test_branch(&mut txn, 1, 0);
974 let leaf_id = LeafId::new(NodeId::new(1), 0);
975
976 // Create (but don't delete)
977 let insert_op = LeafOp::Insert {
978 after: None,
979 kind: TokenKind::Word,
980 content: b"hello".to_vec(),
981 };
982 apply_leaf_op(
983 &mut txn,
984 &mut context,
985 branch_id,
986 leaf_id,
987 &insert_op,
988 b"hello",
989 )
990 .unwrap();
991
992 // Try to restore
993 let restore_op = LeafOp::Restore { leaf: leaf_id };
994 let result = apply_leaf_op(&mut txn, &mut context, branch_id, leaf_id, &restore_op, &[]);
995
996 assert!(result.is_err());
997 assert!(result.unwrap_err().is_invalid_state());
998 }
999
1000 #[test]
1001 fn test_apply_restore_not_found() {

Callers

nothing calls this directly

Calls 3

create_test_branchFunction · 0.85
apply_leaf_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected