blob: 4b79703aa1cf0a5645ba9ab2f0efed5846d61916 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package todolist
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGroupByContext(t *testing.T) {
assert := assert.New(t)
store := &FileStore{FileLocation: "todos.json"}
list := &TodoList{}
list.Load(store.Load())
grouper := &Grouper{}
grouped := grouper.GroupByContext(list.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"}
list := &TodoList{}
list.Load(store.Load())
grouper := &Grouper{}
grouped := grouper.GroupByProject(list.Todos())
assert.Equal(2, len(grouped.Groups["test1"]), "")
}
|