23 lines
975 B
Go
23 lines
975 B
Go
package models
|
|
|
|
import "testing"
|
|
|
|
func TestTicket42OnlyRSSSourcesAreOperationalEvenIfLegacyRowsWereReenabled(t *testing.T) {
|
|
sources := []Source{}
|
|
for _, key := range []string{SourceYahooFinance, SourceCNBCBusiness, SourceWatcherGuru, SourceBloomberg, SourceInvesting} {
|
|
key := key
|
|
sources = append(sources, Source{ID: key, SourceKey: &key, Enabled: true, ArticleLimit: 77})
|
|
want := key == SourceBloomberg || key == SourceInvesting
|
|
if SupportedSourceKey(key) != want {
|
|
t.Errorf("source %s supported=%v, want %v", key, SupportedSourceKey(key), want)
|
|
}
|
|
}
|
|
got := OperationalSources(sources)
|
|
if len(got) != 2 || *got[0].SourceKey != SourceBloomberg || *got[1].SourceKey != SourceInvesting {
|
|
t.Fatal("legacy SQL-enabled source remained operational")
|
|
}
|
|
if !sources[0].Enabled || *sources[0].SourceKey != "yahoo_finance" || sources[0].ArticleLimit != 77 || *sources[1].SourceKey != "cnbc_business" {
|
|
t.Fatal("filter mutated historical identities/caps")
|
|
}
|
|
}
|