aboutsummaryrefslogtreecommitdiff
path: root/config/config_test.go
blob: 20f0a1e5fdf3db258e693b71b974a817ea020742 (plain) (blame)
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
package config

import (
	"testing"
)

const schemaPath string = "../config_schema.json"

func TestNoConfig(t *testing.T) {
	_, err := ReadConfig("../test/sfklase.yml", schemaPath)
	if err == nil {
		t.Errorf("Non-existent config was successfully read")
	}
}

func TestGoodConfig(t *testing.T) {
	_, err := ReadConfig("../test/good_config.yml", schemaPath)
	if err != nil {
		t.Errorf("Good config is not accepted: %v", err)
	}
}

func TestBadConfig(t *testing.T) {
	_, err := ReadConfig("../test/bad_config.yml", schemaPath)
	if err == nil {
		t.Errorf("Bad config is accepted but it shouldn't!")
	} else {
		t.Log(err)
	}
}