-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig_test.go
42 lines (36 loc) · 944 Bytes
/
config_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
package ghaprofiler
import (
"reflect"
"testing"
)
func Test_Validate(t *testing.T) {
config, err := LoadConfigFromTOML("fixtures/valid-config.toml")
if err != nil {
t.Fatal(err)
}
err = config.Validate()
if err != nil {
t.Fatalf("Validation failed for ghaprofiler.DefaultProfileConfig(): %v", err)
}
}
func Test_LoadFromTOML(t *testing.T) {
expectedConfig := &ProfileConfig{
AccessToken: "YOUR_ACCESS_TOKEN",
Concurrency: 2,
Cache: true,
CacheDirectory: "/tmp/cache",
NumberOfJob: 100,
Format: "table",
Owner: "utgwkk",
Repository: "Twitter-Text",
SortBy: "number",
WorkflowFileName: "ci.yml",
}
config, err := LoadConfigFromTOML("fixtures/valid-config.toml")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(config, expectedConfig) {
t.Fatalf("Loaded config is not correct\ngot: %#v\nwant: %#v", config, expectedConfig)
}
}