generated from rmcguire/go-server-with-otel
add ui, new config opts
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestWebUIEnabledDefaultsTrue(t *testing.T) {
|
||||
tru, fls := true, false
|
||||
cases := []struct {
|
||||
name string
|
||||
in *bool
|
||||
want bool
|
||||
}{
|
||||
{"unset defaults to enabled", nil, true},
|
||||
{"explicit true", &tru, true},
|
||||
{"explicit false", &fls, false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
c := &ServiceConfig{EnableWebUI: tc.in}
|
||||
if got := c.WebUIEnabled(); got != tc.want {
|
||||
t.Errorf("WebUIEnabled() = %v, want %v", got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user