diff options
| author | Grant Ammons <gammons@gmail.com> | 2016-04-25 14:35:43 -0400 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2016-04-25 14:35:43 -0400 |
| commit | a0f7203996439210b2a40663eeeeb8563ab03d68 (patch) | |
| tree | 84f7bd055f5cc581fa2b4894206868c998512d1a /todolist/grouper_test.go | |
| parent | dde4f5330c2126af0e3ec17e4098653c6f551426 (diff) | |
Get grouping working correctly
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"]), "") +} |
