From a0f7203996439210b2a40663eeeeb8563ab03d68 Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Mon, 25 Apr 2016 14:35:43 -0400 Subject: Get grouping working correctly --- todolist/grouper_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 todolist/grouper_test.go (limited to 'todolist/grouper_test.go') diff --git a/todolist/grouper_test.go b/todolist/grouper_test.go new file mode 100644 index 0000000..0b610f0 --- /dev/null +++ b/todolist/grouper_test.go @@ -0,0 +1,32 @@ +package todolist + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGroupByContext(t *testing.T) { + assert := assert.New(t) + + store := &FileStore{FileLocation: "todos.json"} + store.Load() + + grouper := &Grouper{} + grouped := grouper.GroupByContext(store.Todos()) + + assert.Equal(2, len(grouped.Groups["root"]), "") + assert.Equal(1, len(grouped.Groups["more"]), "") +} + +func TestGroupByProject(t *testing.T) { + assert := assert.New(t) + + store := &FileStore{FileLocation: "todos.json"} + store.Load() + + grouper := &Grouper{} + grouped := grouper.GroupByProject(store.Todos()) + + assert.Equal(2, len(grouped.Groups["test1"]), "") +} -- cgit v1.3