mirror of
https://github.com/go-eagle/eagle.git
synced 2025-09-26 20:41:26 +08:00

* 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
36 lines
688 B
Go
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)
|
|
})
|
|
}
|