aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/grouper_test.go
blob: 0b610f083c228dcb37610519d4cb22986bacfe4c (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
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"]), "")
}