start with a test of the interactive
This commit is contained in:
parent
256f622a57
commit
b53807c4a6
|
@ -166,9 +166,32 @@ Checked into sheet \"default\".\n");
|
||||||
|
|
||||||
ResumeCommand::handle(args, &mut streams, &facts).unwrap();
|
ResumeCommand::handle(args, &mut streams, &facts).unwrap();
|
||||||
|
|
||||||
assert_eq!(Ps(&String::from_utf8_lossy(&streams.out)), Ps("\
|
assert_str_eq!(&String::from_utf8_lossy(&streams.out), "\
|
||||||
No entry to resume in the sheet 'default'. Perhaps start a new one?
|
No entry to resume in the sheet 'default'. Perhaps start a new one?
|
||||||
Hint: use t in
|
Hint: use t in
|
||||||
"));
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn resume_interactive() {
|
||||||
|
let args = Args {
|
||||||
|
entry: SelectedEntry::Interactive,
|
||||||
|
at: None,
|
||||||
|
};
|
||||||
|
let mut streams = Streams::fake(b"1\n");
|
||||||
|
let facts = Facts::new();
|
||||||
|
let one_hour_ago = facts.now - Duration::hours(1);
|
||||||
|
let two_hours_ago = facts.now - Duration::hours(2);
|
||||||
|
|
||||||
|
// insert some entries to pick from
|
||||||
|
streams.db.entry_insert(two_hours_ago, Some(one_hour_ago), Some("fake note".into()), "default").unwrap();
|
||||||
|
|
||||||
|
// call the command interactively
|
||||||
|
ResumeCommand::handle(args, &mut streams, &facts).unwrap();
|
||||||
|
|
||||||
|
// check the output
|
||||||
|
assert_str_eq!(&String::from_utf8_lossy(&streams.out), "Resuming \"fake note\"
|
||||||
|
Checked into sheet \"default\".\n");
|
||||||
|
assert_str_eq!(&String::from_utf8_lossy(&streams.err), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue