aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/todo_list_test.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2017-03-03 18:30:06 -0500
committerGrant Ammons <gammons@gmail.com>2017-03-03 18:30:06 -0500
commitc2114f083afeb1ac2cc28e9a83f3a9c591b59a1f (patch)
tree0ef4b9c60917e1428202cbb9b0fcc6abd20adb3c /todolist/todo_list_test.go
parentbe32789ec53ebe0a2141cf4d13696280ef79ee7f (diff)
Add priority feature
Now, todos have a priority flag. When listed, these todos will be bolded and italic. You can list todos by priority by running `todolist l p`.
Diffstat (limited to 'todolist/todo_list_test.go')
-rw-r--r--todolist/todo_list_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/todolist/todo_list_test.go b/todolist/todo_list_test.go
index 8a40b14..bd0f926 100644
--- a/todolist/todo_list_test.go
+++ b/todolist/todo_list_test.go
@@ -77,3 +77,23 @@ func TestUncomplete(t *testing.T) {
list.Uncomplete(2)
assert.Equal(false, list.FindById(2).Completed)
}
+
+func TestPrioritizeNotInTodosJson(t *testing.T) {
+ assert := assert.New(t)
+ store := &FileStore{FileLocation: "todos.json"}
+ list := &TodoList{}
+ todos, _ := store.Load()
+ list.Load(todos)
+ assert.Equal(false, list.FindById(2).IsPriority)
+}
+
+func TestPrioritizeTodo(t *testing.T) {
+ assert := assert.New(t)
+ list := &TodoList{}
+ todo := &Todo{Archived: false, Completed: false, Subject: "testing", IsPriority: false}
+ list.Add(todo)
+ list.Prioritize(1)
+ assert.Equal(true, list.FindById(1).IsPriority)
+ list.Unprioritize(1)
+ assert.Equal(false, list.FindById(1).IsPriority)
+}