-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag_test.go
49 lines (36 loc) · 846 Bytes
/
tag_test.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
package api_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/lieut-data/go-moneywell/api"
)
func TestGetTags(t *testing.T) {
t.Parallel()
database, err := api.OpenDocument("Test.moneywell")
assert.NoError(t, err)
defer database.Close()
tags, err := api.GetTags(database)
assert.NoError(t, err)
expectedTags := []api.Tag{
{1, "tag1"},
{2, "tag2"},
{3, "tag3"},
{4, "tag4"},
}
assert.Equal(t, expectedTags, tags)
}
func TestGetTagsMap(t *testing.T) {
t.Parallel()
database, err := api.OpenDocument("Test.moneywell")
assert.NoError(t, err)
defer database.Close()
tagsMap, err := api.GetTagsMap(database)
assert.NoError(t, err)
expectedTagsMap := map[int64]api.Tag{
1: {1, "tag1"},
2: {2, "tag2"},
3: {3, "tag3"},
4: {4, "tag4"},
}
assert.Equal(t, expectedTagsMap, tagsMap)
}