test: logs pkg
parent
49cb7ca0d0
commit
ad93c6b047
|
@ -0,0 +1,25 @@
|
|||
package logs
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConfig_GetConfig(t *testing.T) {
|
||||
t.Run("test default behavior", func(t *testing.T) {
|
||||
Init()
|
||||
config := getConfig()
|
||||
assert.Equal(t, logrus.DebugLevel, config.Level)
|
||||
})
|
||||
|
||||
t.Run("test custom log level", func(t *testing.T) {
|
||||
_ = os.Setenv("LOG_LEVEL", "warn")
|
||||
defer os.Clearenv()
|
||||
|
||||
Init()
|
||||
config := getConfig()
|
||||
assert.Equal(t, logrus.WarnLevel, config.Level)
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue