telegabber/config/config_test.go

31 lines
626 B
Go
Raw Permalink Normal View History

package config
import (
"testing"
)
2019-10-29 01:23:57 +00:00
const schemaPath string = "../config_schema.json"
2019-10-25 18:12:38 +00:00
func TestNoConfig(t *testing.T) {
2019-10-29 01:23:57 +00:00
_, err := ReadConfig("../test/sfklase.yml", schemaPath)
if err == nil {
t.Errorf("Non-existent config was successfully read")
}
}
func TestGoodConfig(t *testing.T) {
2019-10-29 01:23:57 +00:00
_, err := ReadConfig("../test/good_config.yml", schemaPath)
if err != nil {
t.Errorf("Good config is not accepted: %v", err)
}
}
func TestBadConfig(t *testing.T) {
2019-10-29 01:23:57 +00:00
_, err := ReadConfig("../test/bad_config.yml", schemaPath)
if err == nil {
2019-10-25 18:12:38 +00:00
t.Errorf("Bad config is accepted but it shouldn't!")
} else {
t.Log(err)
}
}