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

Function test_apply_create

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

Source from the content-addressed store, hash-verified

528
529 #[test]
530 fn test_apply_create() {
531 let mut txn = MockTxn::new();
532 let mut context = ApplyContext::new(ApplyOptions::default());
533 let trunk_id = TrunkId::new(NodeId::new(1), 0);
534
535 let op = TrunkOp::Create {
536 path: "test.rs".to_string(),
537 encoding: Some(Encoding::Utf8),
538 };
539
540 apply_trunk_op(&mut txn, &mut context, trunk_id, &op).unwrap();
541
542 assert!(txn.has_trunk(trunk_id).unwrap());
543 let trunk = txn.get_trunk(trunk_id).unwrap().unwrap();
544 assert_eq!(trunk.path(), "test.rs");
545 assert_eq!(trunk.encoding(), Some(Encoding::Utf8));
546 assert_eq!(context.stats().trunks_created(), 1);
547 }
548
549 #[test]
550 fn test_apply_create_duplicate_id() {

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