mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 12:17:06 +00:00
30 lines
626 B
Go
30 lines
626 B
Go
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)
|
|
}
|
|
}
|