Update tests

This commit is contained in:
Dheepak Krishnamurthy 2021-03-24 00:05:49 -06:00
parent 2061d0e914
commit bb9c023a14

View file

@ -597,7 +597,7 @@ impl TTApp {
fn task_by_index(&self, i: usize) -> Option<Task> { fn task_by_index(&self, i: usize) -> Option<Task> {
let tasks = &self.tasks.lock().unwrap(); let tasks = &self.tasks.lock().unwrap();
if i > tasks.len() { if i >= tasks.len() {
None None
} else { } else {
Some(tasks[i].clone()) Some(tasks[i].clone())
@ -2094,11 +2094,11 @@ mod tests {
#[test] #[test]
fn test_taskwarrior_tui() { fn test_taskwarrior_tui() {
let app = TTApp::new().unwrap(); let app = TTApp::new().unwrap();
assert!(app.task_by_index(1).is_none()); assert!(app.task_by_index(0).is_none());
let app = TTApp::new().unwrap(); let app = TTApp::new().unwrap();
assert!(app assert!(app
.task_by_uuid(Uuid::parse_str("0b11967d-9dae-4333-a137-c3b1e8a641d3").unwrap()) .task_by_uuid(Uuid::parse_str("3f43831b-88dc-45e2-bf0d-4aea6db634cc").unwrap())
.is_none()); .is_none());
test_draw_empty_task_report(); test_draw_empty_task_report();
@ -2106,11 +2106,11 @@ mod tests {
setup(); setup();
let app = TTApp::new().unwrap(); let app = TTApp::new().unwrap();
assert!(app.task_by_index(1).is_some()); assert!(app.task_by_index(0).is_some());
let app = TTApp::new().unwrap(); let app = TTApp::new().unwrap();
assert!(app assert!(app
.task_by_uuid(Uuid::parse_str("0b11967d-9dae-4333-a137-c3b1e8a641d3").unwrap()) .task_by_uuid(Uuid::parse_str("3f43831b-88dc-45e2-bf0d-4aea6db634cc").unwrap())
.is_some()); .is_some());
test_draw_task_report(); test_draw_task_report();
@ -2181,7 +2181,6 @@ mod tests {
assert!(app.get_context().is_ok()); assert!(app.get_context().is_ok());
assert!(app.update(true).is_ok()); assert!(app.update(true).is_ok());
app.context_next();
app.context_select().unwrap(); app.context_select().unwrap();
assert_eq!(app.tasks.lock().unwrap().len(), 26); assert_eq!(app.tasks.lock().unwrap().len(), 26);