aboutsummaryrefslogblamecommitdiff
path: root/config/config_test.go
blob: 6fce23bf40f4162d97e80956b7b514449d1f7aa4 (plain) (tree)
1
2
3
4
5
6
7
8
9





                 

                                                  
                                 
                                                                





                                                                     
                                                                    





                                                                
                                                                   
                       


                                                                    

         
package config

import (
	"testing"
)

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

func TestNoConfig(t *testing.T) {
	_, 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", 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", SCHEMA_PATH)
	if err == nil {
		t.Errorf("Bad config is accepted but it shouldn't!")
	} else {
		t.Log(err)
	}
}