forked from Furumi/furumi-web
Publish podcasts after the first device sync on restart
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abd100d6e7
commit
0e985b4267
8 files changed
+328
-27
No files matched your search
@@ -0,0 +1,34 @@
|
||||
//! 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::<u32>::new(done);
|
||||
round.started([]);
|
||||
assert!(*watch.borrow());
|
||||
}
|
||||
Reference in new issue
Block a user