mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-16 04:44:55 +02:00
29 lines
685 B
Go
29 lines
685 B
Go
package utils
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
log "github.com/inconshreveable/log15"
|
|
)
|
|
|
|
func TestParseLogFormatter(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
arg string
|
|
want log.Format
|
|
}{
|
|
{"Default", "", log.TerminalFormat()},
|
|
{"LogFmt", "logfmt", log.LogfmtFormat()},
|
|
{"Json", "json", log.JsonFormat()},
|
|
{"JsonPretty", "json-pretty", log.JsonFormat()},
|
|
{"Unknown", "unknown", log.TerminalFormat()},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := ParseLogFormatter(tt.arg); reflect.ValueOf(got).Pointer() != reflect.ValueOf(tt.want).Pointer() {
|
|
t.Errorf("parseLogFormatter() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|