blob: 12a1018825b451453b1effab514fe62ae830c64c (
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
35
36
|
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{}
todos, _ := store.Load()
list.Load(todos)
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{}
todos, _ := store.Load()
list.Load(todos)
grouper := &Grouper{}
grouped := grouper.GroupByProject(list.Todos())
assert.Equal(2, len(grouped.Groups["test1"]), "")
}
|