feat(sources): retire Yahoo and CNBC feeds (#42)
This commit is contained in:
@ -41,10 +41,11 @@ func (f *ticket13Feed) Scrape(context.Context, []string) ([]scraper.Article, err
|
||||
return []scraper.Article{{Title: "fixture"}}, nil
|
||||
}
|
||||
|
||||
func TestScheduledGenerationUsesSameThreeSourceAllowlistForEnabledLegacyRows(t *testing.T) {
|
||||
func TestScheduledGenerationUsesSameTwoRSSSourceAllowlistForEnabledLegacyRows(t *testing.T) {
|
||||
var sources []models.Source
|
||||
if err := json.Unmarshal([]byte(`[
|
||||
{"id":"y","type":"stocktwits","source_key":"yahoo_finance","enabled":true,"article_limit":10},
|
||||
{"id":"i","name":"Investing.com","type":"investing_com","source_key":"investing_com","enabled":true,"article_limit":20},
|
||||
{"id":"b","type":"bloomberg","source_key":"bloomberg","enabled":true,"article_limit":10},
|
||||
{"id":"c","name":"CNBC Business","type":"cnbc_business","source_key":"cnbc_business","enabled":true,"article_limit":20},
|
||||
{"id":"w","type":"watcherguru","source_key":"watcher_guru","enabled":true,"article_limit":10},
|
||||
@ -54,7 +55,7 @@ func TestScheduledGenerationUsesSameThreeSourceAllowlistForEnabledLegacyRows(t *
|
||||
}
|
||||
feeds := map[string]*ticket13Feed{}
|
||||
scrapers := map[string]scraper.Scraper{}
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "cnbc_business", "watcher_guru", "stocktwits", "reuters"} {
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "cnbc_business", "investing_com", "watcher_guru", "stocktwits", "reuters"} {
|
||||
f := &ticket13Feed{}
|
||||
feeds[key] = f
|
||||
scrapers[key] = f
|
||||
@ -62,12 +63,12 @@ func TestScheduledGenerationUsesSameThreeSourceAllowlistForEnabledLegacyRows(t *
|
||||
uc := generation.NewUseCase(generation.Dependencies{Repository: ticket13Repository{generation.UserInput{Language: "fr", RankingMode: "title", GlobalLimit: 10, Assets: []models.UserAsset{{Symbol: "SPX"}}, Sources: sources}}, Scrapers: scrapers, Ranker: ticket13Ranker{}, Summarizer: ticket13Summary{}})
|
||||
s := &Scheduler{users: ticket13Users{}, generationUseCase: uc}
|
||||
s.run()
|
||||
for _, key := range []string{"yahoo_finance", "bloomberg", "cnbc_business"} {
|
||||
for _, key := range []string{"bloomberg", "investing_com"} {
|
||||
if feeds[key].calls != 1 {
|
||||
t.Errorf("scheduled supported source %s calls=%d, want 1", key, feeds[key].calls)
|
||||
}
|
||||
}
|
||||
for _, key := range []string{"watcher_guru", "stocktwits", "reuters"} {
|
||||
for _, key := range []string{"yahoo_finance", "cnbc_business", "watcher_guru", "stocktwits", "reuters"} {
|
||||
if feeds[key].calls != 0 {
|
||||
t.Errorf("scheduled legacy source %s was called %d times", key, feeds[key].calls)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user