package config import ( "reflect" "testing" ) func TestSourceConfigExpectedKinds(t *testing.T) { tests := []struct { name string cfg SourceConfig want []string }{ { name: "plural kinds normalized", cfg: SourceConfig{ Kinds: []string{" observation ", "forecast"}, }, want: []string{"observation", "forecast"}, }, { name: "empty kinds", cfg: SourceConfig{}, want: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := tt.cfg.ExpectedKinds() if !reflect.DeepEqual(got, tt.want) { t.Fatalf("ExpectedKinds() = %#v, want %#v", got, tt.want) } }) } } func TestSourceModeNormalize(t *testing.T) { if got := SourceMode(" Poll ").Normalize(); got != SourceModePoll { t.Fatalf("Normalize poll = %q, want %q", got, SourceModePoll) } if got := SourceMode("STREAM").Normalize(); got != SourceModeStream { t.Fatalf("Normalize stream = %q, want %q", got, SourceModeStream) } if got := SourceMode("").Normalize(); got != SourceModeAuto { t.Fatalf("Normalize auto = %q, want %q", got, SourceModeAuto) } }