feat(conf): test conf
This commit is contained in:
parent
0b88178df0
commit
6b80b30f31
|
@ -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")
|
||||
}
|
Loading…
Reference in New Issue