added test files
This commit is contained in:
27
pkg/logger/logger_test.go
Normal file
27
pkg/logger/logger_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
func TestInitializeZapGlobals_InfoLevel(t *testing.T) {
|
||||
initializeZapGlobals("info")
|
||||
|
||||
if zap.L().Core().Enabled(zapcore.DebugLevel) {
|
||||
t.Error("debug level should be disabled when LOG_LEVEL is info")
|
||||
}
|
||||
if !zap.L().Core().Enabled(zapcore.InfoLevel) {
|
||||
t.Error("info level should be enabled")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitializeZapGlobals_DebugLevel(t *testing.T) {
|
||||
initializeZapGlobals("debug")
|
||||
|
||||
if !zap.L().Core().Enabled(zapcore.DebugLevel) {
|
||||
t.Error("debug level should be enabled")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user