package logger import ( "log/slog" "testing" "github.com/stretchr/testify/assert" ) func TestNew_ReturnsNonNil(t *testing.T) { l := New("info") assert.NotNil(t, l) } func TestParseLevel(t *testing.T) { cases := []struct { in string want slog.Level }{ {"debug", slog.LevelDebug}, {"DEBUG", slog.LevelDebug}, {"info", slog.LevelInfo}, {"warn", slog.LevelWarn}, {"warning", slog.LevelWarn}, {"error", slog.LevelError}, {"err", slog.LevelError}, {"", slog.LevelInfo}, {"invalid", slog.LevelInfo}, } for _, tc := range cases { t.Run(tc.in, func(t *testing.T) { assert.Equal(t, tc.want, parseLevel(tc.in)) }) } }