//! The first device-sync round that the podcast publication reconciler //! waits for ([`FirstSyncRound`]). use super::FirstSyncRound; #[test] fn the_first_round_ends_when_its_last_exchange_ends() { let (done, watch) = tokio::sync::watch::channel(false); let mut round = FirstSyncRound::new(done); // An exchange that ends before the first complete listing is not // waited for. round.finished(&7); assert!(!*watch.borrow()); round.started([1, 2]); // A later listing (with exchanges it started) changes nothing. round.started([3]); round.finished(&1); round.finished(&3); assert!(!*watch.borrow()); round.finished(&2); assert!(*watch.borrow()); // Stays done. round.started([4]); round.finished(&4); assert!(*watch.borrow()); } #[test] fn without_trusted_devices_the_first_round_ends_at_once() { let (done, watch) = tokio::sync::watch::channel(false); let mut round = FirstSyncRound::::new(done); round.started([]); assert!(*watch.borrow()); }