forked from p93542168/wheat-cache
37 lines
617 B
Go
37 lines
617 B
Go
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")
|
|
}
|