snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s
Some checks failed
build / build (push) Failing after 3s
This commit is contained in:
22
config/loglevel_test.go
Normal file
22
config/loglevel_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestLogLevel_Decode_success(t *testing.T) {
|
||||
ll := new(LogLevel)
|
||||
err := ll.Decode("fatal")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, ll.AsZeroLogLevel(), zerolog.FatalLevel)
|
||||
}
|
||||
|
||||
func TestLogLevel_Decode_fail(t *testing.T) {
|
||||
ll := new(LogLevel)
|
||||
err := ll.Decode("asdasdasdasdasdasd")
|
||||
assert.EqualError(t, err, "unknown log level")
|
||||
assert.Equal(t, ll.AsZeroLogLevel(), zerolog.InfoLevel)
|
||||
}
|
||||
Reference in New Issue
Block a user