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

Function test_apply_create

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

Source from the content-addressed store, hash-verified

535
536 #[test]
537 fn test_apply_create() {
538 let mut txn = MockTxn::new();
539 let mut context = ApplyContext::new(ApplyOptions::default());
540 let trunk_id = TrunkId::new(NodeId::new(1), 0);
541
542 let op = TrunkOp::Create {
543 path: "test.rs".to_string(),
544 encoding: Some(Encoding::Utf8),
545 };
546
547 apply_trunk_op(&mut txn, &mut context, trunk_id, &op).unwrap();
548
549 assert!(txn.has_trunk(trunk_id).unwrap());
550 let trunk = txn.get_trunk(trunk_id).unwrap().unwrap();
551 assert_eq!(trunk.path(), "test.rs");
552 assert_eq!(trunk.encoding(), Some(Encoding::Utf8));
553 assert_eq!(context.stats().trunks_created(), 1);
554 }
555
556 #[test]
557 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