diff --git a/crates/bft-json-crdt/tests/byzantine.rs b/crates/bft-json-crdt/tests/byzantine.rs index 792874b..661f50e 100644 --- a/crates/bft-json-crdt/tests/byzantine.rs +++ b/crates/bft-json-crdt/tests/byzantine.rs @@ -30,7 +30,6 @@ struct ListExample { fn test_valid_updates() { // Insert to crdt.doc on local node, test applying the same operation to a remote node // and check that the view is the same - let key = make_keypair(); let mut crdt = BaseCrdt::::new(&key); let _a = crdt.doc.list.insert(ROOT_ID, 'a').sign(&key); @@ -42,14 +41,23 @@ fn test_valid_updates() { let key2 = make_keypair(); let mut crdt2 = BaseCrdt::::new(&key2); crdt2.apply(_a.clone()); - crdt2.apply(_a.clone()); crdt2.apply(_b); - crdt2.apply(_c); - crdt2.apply(_a); - let _d = crdt2.doc.list.insert(_d.id(), 'c').sign(&key); // fix this in the morning + crdt2.apply(_c.clone()); - // Ok something is seriously wrong here. - assert_eq!(crdt2.doc.list.view(), crdt.doc.list.view()); + assert_eq!( + crdt2.doc.list.view(), + crdt.doc.list.view(), + "views should be equal" + ); + + crdt2.apply(_a.clone()); + crdt2.apply(_a); + + assert_eq!( + crdt.doc.list.view(), + crdt2.doc.list.view(), + "views are still equal after repeated applies" + ); } // case 2a + 2b