aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/file_store_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'todolist/file_store_test.go')
-rw-r--r--todolist/file_store_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/todolist/file_store_test.go b/todolist/file_store_test.go
index 3e10491..d71c119 100644
--- a/todolist/file_store_test.go
+++ b/todolist/file_store_test.go
@@ -25,3 +25,22 @@ func TestNextId(t *testing.T) {
store.Load()
assert.Equal(3, store.NextId())
}
+
+func TestIndexOf(t *testing.T) {
+ assert := assert.New(t)
+ todo := &Todo{Subject: "Grant"}
+ store := &FileStore{FileLocation: "todos.json"}
+ store.Load()
+
+ assert.Equal(-1, store.IndexOf(todo))
+ assert.Equal(0, store.IndexOf(&store.Data[0]))
+}
+
+func TestDelete(t *testing.T) {
+ assert := assert.New(t)
+ store := &FileStore{FileLocation: "todos.json"}
+ store.Load()
+ assert.Equal(2, len(store.Data))
+ store.Delete(1)
+ assert.Equal(1, len(store.Data))
+}