diff --git a/rslib/src/scheduler/answering/mod.rs b/rslib/src/scheduler/answering/mod.rs index 11d5830de..dee15a755 100644 --- a/rslib/src/scheduler/answering/mod.rs +++ b/rslib/src/scheduler/answering/mod.rs @@ -443,6 +443,9 @@ mod test { #[test] fn state_application() -> Result<()> { let mut col = open_test_collection(); + if col.timing_today()?.near_cutoff() { + return Ok(()); + } let nt = col.get_notetype_by_name("Basic")?.unwrap(); let mut note = nt.new_note(); col.add_note(&mut note, DeckId(1))?; diff --git a/rslib/src/scheduler/queue/undo.rs b/rslib/src/scheduler/queue/undo.rs index 8fe72e360..3e50dd046 100644 --- a/rslib/src/scheduler/queue/undo.rs +++ b/rslib/src/scheduler/queue/undo.rs @@ -200,6 +200,9 @@ mod test { #[test] fn undo_counts() -> Result<()> { let mut col = open_test_collection(); + if col.timing_today()?.near_cutoff() { + return Ok(()); + } assert_eq!(col.counts(), [0, 0, 0]); add_note(&mut col, true)?; diff --git a/rslib/src/scheduler/timing.rs b/rslib/src/scheduler/timing.rs index f89133332..2e02fa845 100644 --- a/rslib/src/scheduler/timing.rs +++ b/rslib/src/scheduler/timing.rs @@ -197,6 +197,18 @@ mod test { use super::*; + // test helper + impl SchedTimingToday { + /// Check if less than 25 minutes until the rollover + pub fn near_cutoff(&self) -> bool { + let near = TimestampSecs::now().adding_secs(60 * 25) > self.next_day_at; + if near { + println!("this would fail near the rollover time"); + } + near + } + } + // static timezone for tests const AEST_MINS_WEST: i32 = -600;