diff --git a/autosurgeon/src/reconcile.rs b/autosurgeon/src/reconcile.rs index 9a92f1a..c382f48 100644 --- a/autosurgeon/src/reconcile.rs +++ b/autosurgeon/src/reconcile.rs @@ -1072,4 +1072,53 @@ mod tests { }} ); } + + fn test_prop_with_transaction() { + let mut doc = automerge::Automerge::new(); + let mut tx = doc.transaction(); + + let bob = Contact { + name: "bob".to_string(), + id: 1, + addresses: vec![Address { + line_one: "line one".to_string(), + line_two: "line two".to_string(), + }], + }; + reconcile(&mut tx, &bob).unwrap(); + tx.commit(); + + assert_doc!( + &doc, + map! { + "name" => { "bob" }, + "id" => { 1_u64 }, + "addresses" => { list!{ + { map! { + "line_one" => { "line one" }, + "line_two" => { "line two" }, + }} + } + }} + ); + + let mut tx = doc.transaction(); + reconcile_prop(&mut tx, automerge::ROOT, "name", "Alice".to_owned()).unwrap(); + tx.commit(); + + assert_doc!( + &doc, + map! { + "name" => { "alice" }, + "id" => { 1_u64 }, + "addresses" => { list!{ + { map! { + "line_one" => { "line one" }, + "line_two" => { "line two" }, + }} + } + }} + ); + + } }