feat(conf): test conf

This commit is contained in:
bandl 2021-09-05 17:08:13 +08:00
parent 0b88178df0
commit 6b80b30f31
1 changed files with 36 additions and 0 deletions

36
conf/public_conf_test.go Normal file
View File

@ -0,0 +1,36 @@
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")
}