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:550–571  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

548
549 #[test]
550 fn test_apply_create_duplicate_id() {
551 let mut txn = MockTxn::new();
552 let mut context = ApplyContext::new(ApplyOptions::default());
553 let trunk_id = TrunkId::new(NodeId::new(1), 0);
554
555 let op = TrunkOp::Create {
556 path: "test.rs".to_string(),
557 encoding: None,
558 };
559
560 apply_trunk_op(&mut txn, &mut context, trunk_id, &op).unwrap();
561
562 // Try to create again with same ID
563 let op2 = TrunkOp::Create {
564 path: "other.rs".to_string(),
565 encoding: None,
566 };
567
568 let result = apply_trunk_op(&mut txn, &mut context, trunk_id, &op2);
569 assert!(result.is_err());
570 assert!(result.unwrap_err().is_already_exists());
571 }
572
573 #[test]
574 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