diff options
| author | tv <tv@krebsco.de> | 2026-10-31 19:03:15 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 19:03:15 +0100 |
| commit | e4f801db5d150fb1bf5540d9ba00f491a6129a5c (patch) | |
| tree | 38a8b5ffd8233df7d24f9bb5effac58cbd92187e /src/remake/catchup.rs | |
| parent | 4a6403d0242cf730a3f864c8d26e0ba15a98fcf0 (diff) | |
tests write through document::testing helpers
Diffstat (limited to 'src/remake/catchup.rs')
| -rw-r--r-- | src/remake/catchup.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index 0be7dfd..e265d0b 100644 --- a/src/remake/catchup.rs +++ b/src/remake/catchup.rs @@ -555,6 +555,7 @@ async fn abandon<H: Host>(host: &H, rejoin: Rejoin, reason: String) { #[cfg(test)] mod tests { use super::*; + use crate::document::testing::change; use crate::remake::snapshot::{SnapshotParams, build}; use automerge::{ActorId, ROOT, transaction::Transactable}; use serde_json::{Value as JsonValue, json}; @@ -563,8 +564,7 @@ mod tests { /// document of the next epoch (snapshot plus one foreign change). fn scenario(policy: &JsonValue) -> (AutoCommit, AutoCommit, Epoch) { let mut old = AutoCommit::new().with_actor(ActorId::from(&b"late-node"[..])); - old.put(ROOT, "base", 1_i64).unwrap(); - old.commit(); + change(&mut old, |old| old.put(ROOT, "base", 1_i64).unwrap()); let base = old.get_heads(); let snapshot = build( @@ -584,11 +584,11 @@ mod tests { let target = snapshot.epoch; let mut swarm = snapshot.doc.with_actor(ActorId::from(&b"swarm-node"[..])); - swarm.put(ROOT, "theirs", 1_i64).unwrap(); - swarm.commit(); + change(&mut swarm, |swarm| { + swarm.put(ROOT, "theirs", 1_i64).unwrap() + }); - old.put(ROOT, "mine", 1_i64).unwrap(); - old.commit(); + change(&mut old, |old| old.put(ROOT, "mine", 1_i64).unwrap()); (old, swarm, target) } |
