aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/file_store_test.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2016-05-01 15:07:45 -0400
committerGrant Ammons <gammons@gmail.com>2016-05-01 15:07:45 -0400
commit0905a863f50d9631e6c44488b952622e75d79785 (patch)
tree0634e9bd9e176660ad3d3260b24f08825aa85c67 /todolist/file_store_test.go
parentef9427646b9464d1f8c376f75741e737117a1a83 (diff)
Implement delete logic
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))
+}