mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
suppress some tests around the daily rollover
This commit is contained in:
parent
47076b9ac5
commit
ea20c31b53
3 changed files with 18 additions and 0 deletions
|
@ -443,6 +443,9 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn state_application() -> Result<()> {
|
fn state_application() -> Result<()> {
|
||||||
let mut col = open_test_collection();
|
let mut col = open_test_collection();
|
||||||
|
if col.timing_today()?.near_cutoff() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let nt = col.get_notetype_by_name("Basic")?.unwrap();
|
let nt = col.get_notetype_by_name("Basic")?.unwrap();
|
||||||
let mut note = nt.new_note();
|
let mut note = nt.new_note();
|
||||||
col.add_note(&mut note, DeckId(1))?;
|
col.add_note(&mut note, DeckId(1))?;
|
||||||
|
|
|
@ -200,6 +200,9 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn undo_counts() -> Result<()> {
|
fn undo_counts() -> Result<()> {
|
||||||
let mut col = open_test_collection();
|
let mut col = open_test_collection();
|
||||||
|
if col.timing_today()?.near_cutoff() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
assert_eq!(col.counts(), [0, 0, 0]);
|
assert_eq!(col.counts(), [0, 0, 0]);
|
||||||
add_note(&mut col, true)?;
|
add_note(&mut col, true)?;
|
||||||
|
|
|
@ -197,6 +197,18 @@ mod test {
|
||||||
|
|
||||||
use super::*;
|
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
|
// static timezone for tests
|
||||||
const AEST_MINS_WEST: i32 = -600;
|
const AEST_MINS_WEST: i32 = -600;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue