feat(sources): replace WatcherGuru with CNBC Business
Add the CNBC Business RSS source, switch supported-source wiring and reporting, and migrate existing WatcherGuru rows to disabled historical status without rewriting references. Refs #23 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -14,6 +14,7 @@ func TestGenerationRoutesOnlyAllowlistedSourceKeysEvenWhenLegacyRowsAreEnabled(t
|
||||
if err := json.Unmarshal([]byte(`[
|
||||
{"id":"y","name":"Yahoo Finance","type":"stocktwits","source_key":"yahoo_finance","enabled":true,"article_limit":20},
|
||||
{"id":"b","name":"Bloomberg","type":"bloomberg","source_key":"bloomberg","enabled":true,"article_limit":20},
|
||||
{"id":"c","name":"CNBC Business","type":"cnbc_business","source_key":"cnbc_business","enabled":true,"article_limit":20},
|
||||
{"id":"w","name":"Watcher.Guru","type":"watcherguru","source_key":"watcher_guru","enabled":true,"article_limit":20},
|
||||
{"id":"s","name":"StockTwits","type":"stocktwits","source_key":null,"enabled":true,"article_limit":20},
|
||||
{"id":"r","name":"Reuters","type":"reuters","source_key":null,"enabled":true,"article_limit":20}
|
||||
@ -22,7 +23,7 @@ func TestGenerationRoutesOnlyAllowlistedSourceKeysEvenWhenLegacyRowsAreEnabled(t
|
||||
}
|
||||
repo := &contractRepository{inputs: map[string]UserInput{"user": {Language: "fr", RankingMode: "title", GlobalLimit: 10, Assets: []models.UserAsset{{Symbol: "SPX"}}, Sources: sources}}, saved: map[string][]GenerationRecord{}}
|
||||
feeds := map[string]*contractScraper{}
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "watcher_guru", "stocktwits", "reuters"} {
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "cnbc_business", "watcher_guru", "stocktwits", "reuters"} {
|
||||
feeds[key] = &contractScraper{name: key, articles: []scraper.Article{{Title: key}}}
|
||||
}
|
||||
scrapers := map[string]scraper.Scraper{}
|
||||
@ -33,12 +34,12 @@ func TestGenerationRoutesOnlyAllowlistedSourceKeysEvenWhenLegacyRowsAreEnabled(t
|
||||
if err != nil || result.Summary == nil {
|
||||
t.Fatalf("generation result=%+v err=%v", result, err)
|
||||
}
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "watcher_guru"} {
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "cnbc_business"} {
|
||||
if len(feeds[key].calls) != 1 {
|
||||
t.Errorf("target %s calls=%d, want one", key, len(feeds[key].calls))
|
||||
}
|
||||
}
|
||||
for _, key := range []string{"stocktwits", "reuters"} {
|
||||
for _, key := range []string{"watcher_guru", "stocktwits", "reuters"} {
|
||||
if len(feeds[key].calls) != 0 {
|
||||
t.Errorf("unsupported enabled source %s was invoked %d times", key, len(feeds[key].calls))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user