aboutsummaryrefslogtreecommitdiff
path: root/config/config_test.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-10-25 21:12:38 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-10-25 21:12:38 +0300
commit695c9fc35325d3bec3ec81bdce59f780acd74e8d (patch)
tree91754643ae5f9cdde3d6e04af5239a3a7ccababa /config/config_test.go
parent72c9dac62cb6282841d22d877852bcee26bff9dd (diff)
Add config validation
Diffstat (limited to 'config/config_test.go')
-rw-r--r--config/config_test.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/config/config_test.go b/config/config_test.go
index 34009d7..6fce23b 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -4,23 +4,27 @@ import (
"testing"
)
+const SCHEMA_PATH string = "../config_schema.json"
+
func TestNoConfig(t *testing.T) {
- _, err := ReadConfig("../test/sfklase.yml")
+ _, err := ReadConfig("../test/sfklase.yml", SCHEMA_PATH)
if err == nil {
t.Errorf("Non-existent config was successfully read")
}
}
func TestGoodConfig(t *testing.T) {
- _, err := ReadConfig("../test/good_config.yml")
+ _, err := ReadConfig("../test/good_config.yml", SCHEMA_PATH)
if err != nil {
t.Errorf("Good config is not accepted: %v", err)
}
}
func TestBadConfig(t *testing.T) {
- _, err := ReadConfig("../test/bad_config.yml")
+ _, err := ReadConfig("../test/bad_config.yml", SCHEMA_PATH)
if err == nil {
- t.Errorf("Bad config is accepted but it shoudn't!")
+ t.Errorf("Bad config is accepted but it shouldn't!")
+ } else {
+ t.Log(err)
}
}