suppress some tests around the daily rollover

This commit is contained in:
Damien Elmes 2021-05-24 14:18:07 +10:00
parent 47076b9ac5
commit ea20c31b53
3 changed files with 18 additions and 0 deletions

View file

@ -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))?;

View file

@ -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)?;

View file

@ -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;