Files
eagle/pkg/config/config_test.go
Richard 77a85538bf chore: upgrade go to v1.19 (#104)
* chore: upgrade go to v1.19

* chore: upgrade golangci-lint to v3.6.0

* chore: setup golangci-lint by using go install

* test: fix unit test
2023-08-10 17:48:17 +08:00

36 lines
688 B
Go

package config
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestLoad(t *testing.T) {
// AppConfig app config
type AppConfig struct {
Name string
Version string
Mode string
PprofPort string
URL string
JwtSecret string
JwtTimeout int
SSL bool
CtxDefaultTimeout time.Duration
CSRF bool
Debug bool
}
var config AppConfig
t.Run("using yaml config", func(t *testing.T) {
c := New("./testdata")
err := c.Load("app", &config)
assert.Nil(t, err)
assert.NotNil(t, config)
assert.Equal(t, "eagle", config.Name)
})
}