WIP test add-scheduled, snapshot, scheduled-due
This commit is contained in:
@@ -490,6 +490,57 @@ mod test_file {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_schedule_date_future_with_snapshot_between_scheduled_and_fired() {
|
||||
tests::with_dir(|d| {
|
||||
tests::write_file(&d, "plain", "- stage");
|
||||
tests::write_file(
|
||||
&d,
|
||||
".plain.host",
|
||||
format!(
|
||||
r#"
|
||||
{{"ts":1, "op":"Add", "task": "stage"}}
|
||||
{{"ts":2, "op":"Snapshot", "task": null, "tasks": ["removed", "old"]}}
|
||||
"#,
|
||||
Delta::now_time() + 50,
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
let f = File::new(&d.path().join("plain").to_str().unwrap().to_string());
|
||||
|
||||
let mut m = serde_yaml::Mapping::new();
|
||||
m.insert("schedule".into(), "2036-01-02".into());
|
||||
let task = Task(serde_yaml::Value::Mapping(m));
|
||||
|
||||
f.append(Delta::add(task)).unwrap();
|
||||
assert_eq!(
|
||||
1,
|
||||
f.events().unwrap().0.len(),
|
||||
"{:?}",
|
||||
f.events().unwrap().0
|
||||
);
|
||||
assert_eq!(0, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
|
||||
f.persist_stage().unwrap();
|
||||
assert_eq!(
|
||||
1,
|
||||
f.events().unwrap().0.len(),
|
||||
"{:?}",
|
||||
f.events().unwrap().0
|
||||
);
|
||||
assert_eq!(0, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
|
||||
f.stage_persisted().unwrap();
|
||||
assert_eq!(
|
||||
1,
|
||||
f.events().unwrap().0.len(),
|
||||
"{:?}",
|
||||
f.events().unwrap().0
|
||||
);
|
||||
assert_eq!(0, f.stage().unwrap().len(), "{:?}", f.stage());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_schedule_date_past() {
|
||||
tests::with_dir(|d| {
|
||||
|
||||
Reference in New Issue
Block a user