-
Notifications
You must be signed in to change notification settings - Fork 0
/
group_test.go
51 lines (39 loc) · 1.3 KB
/
group_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
50
51
package errorg
import (
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"testing"
)
func Test_groupsInitializer(t *testing.T) {
errorsMap = map[string]map[string]interface{}{}
yamlFile := readYaml("config", "configs")
_ = yaml.Unmarshal(yamlFile, &config)
groupsInitializer()
assert.Equal(t, len(errorsMap), 2, "two lengths should be the same.")
}
func Test_groupsInitializer_WrongLocation(t *testing.T) {
errorsMap = map[string]map[string]interface{}{}
yamlFile := readYaml("config", "configs")
_ = yaml.Unmarshal(yamlFile, &config)
if len(config.Plugins) > 0 {
config.Plugins[0].Location = ""
}
groupsInitializer()
assert.Equal(t, len(errorsMap), 0, "two lengths should be the same.")
}
func Test_groupsInitializer_WrongGroup(t *testing.T) {
errorsMap = map[string]map[string]interface{}{}
yamlFile := readYaml("config", "configs")
_ = yaml.Unmarshal(yamlFile, &config)
symName = "wrongGroup"
groupsInitializer()
assert.Equal(t, len(errorsMap), 0, "two lengths should be the same.")
}
func Test_groupsInitializer_WrongCasting(t *testing.T) {
errorsMap = map[string]map[string]interface{}{}
yamlFile := readYaml("config", "configs")
_ = yaml.Unmarshal(yamlFile, &config)
symName = "wrongGroup"
groupsInitializer()
assert.Equal(t, len(errorsMap), 0, "two lengths should be the same.")
}