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

Function test_apply_create_duplicate_id

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

Source from the content-addressed store, hash-verified

555
556 #[test]
557 fn test_apply_create_duplicate_id() {
558 let mut txn = MockTxn::new();
559 let mut context = ApplyContext::new(ApplyOptions::default());
560 let trunk_id = TrunkId::new(NodeId::new(1), 0);
561
562 let op = TrunkOp::Create {
563 path: "test.rs".to_string(),
564 encoding: None,
565 };
566
567 apply_trunk_op(&mut txn, &mut context, trunk_id, &op).unwrap();
568
569 // Try to create again with same ID
570 let op2 = TrunkOp::Create {
571 path: "other.rs".to_string(),
572 encoding: None,
573 };
574
575 let result = apply_trunk_op(&mut txn, &mut context, trunk_id, &op2);
576 assert!(result.is_err());
577 assert!(result.unwrap_err().is_already_exists());
578 }
579
580 #[test]
581 fn test_apply_create_duplicate_id_lenient() {

Callers

nothing calls this directly

Calls 2

apply_trunk_opFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected