wheat-cache/conf/public_conf_test.go

37 lines
617 B
Go
Raw Normal View History

2021-09-05 17:08:13 +08:00
package conf
import (
"testing"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
)
func TestLoadConf(t *testing.T) {
type args struct {
path string
}
tests := []struct {
name string
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := LoadConf(tt.args.path); (err != nil) != tt.wantErr {
t.Errorf("LoadConf() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestConf(t *testing.T) {
viper.Set("host", "1222")
host := viper.GetString("host")
require.Equal(t, host, "1222")
}