diff options
Diffstat (limited to 'todolist/grouper_test.go')
| -rw-r--r-- | todolist/grouper_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
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"]), "") +} |
