package config import ( "bytes" "log/slog" "reflect" "testing" "example.com/golang-base/internal/log" "github.com/stretchr/testify/assert" ) func slogToBuffer() (*bytes.Buffer, *slog.Logger) { buf := new(bytes.Buffer) return buf, slog.New( slog.NewTextHandler( buf, &slog.HandlerOptions{ Level: log.LevelTrace, }, ), ) } func TestPrintRunningConfig(t *testing.T) { buf, l := slogToBuffer() log.L.Log = l c := New() cfgInfo, err := getStructInfo(&c) assert.NoError(t, err) printRunningConfig(&c, cfgInfo) assert.Contains(t, buf.String(), "Running Configuration") } func TestNew(t *testing.T) { c := New() assert.Equal(t, "config.Config", reflect.TypeOf(c).String()) }