feat(sources): retire Yahoo and CNBC feeds (#42)
This commit is contained in:
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestTicket40CanonicalSourceKeyAndReachabilitySeparateFromContent(t *testing.T) {
|
||||
for _, key := range []string{models.SourceYahooFinance, models.SourceBloomberg, models.SourceCNBCBusiness} {
|
||||
for _, key := range []string{models.SourceBloomberg, models.SourceInvesting} {
|
||||
t.Run(key, func(t *testing.T) {
|
||||
feed := &ticket39ContentFeed{}
|
||||
repo := &contractRepository{inputs: map[string]UserInput{"u": {Language: "fr", RankingMode: "title_content", GlobalLimit: 3, Assets: []models.UserAsset{{Name: "Followed fixture"}}, Sources: []models.Source{{ID: "s", Type: "stocktwits", SourceKey: &key, Enabled: true, ArticleLimit: 3}}}}, saved: map[string][]GenerationRecord{}}
|
||||
@ -34,3 +34,18 @@ func TestTicket40CanonicalSourceKeyAndReachabilitySeparateFromContent(t *testing
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTicket42HistoricalSourceKeysAndTypesRemainReadable(t *testing.T) {
|
||||
const payload = `{"status":"partial","source_stats":[{"source_key":"yahoo_finance","source_type":"stocktwits","source_id":"old-y","article_limit":83,"status":"ok"},{"source_key":"cnbc_business","source_type":"cnbc_business","source_id":"old-c","article_limit":31,"status":"ok"}]}`
|
||||
var historical GenerationOutcome
|
||||
if err := json.Unmarshal([]byte(payload), &historical); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if historical.Status != "partial" || len(historical.SourceStats) != 2 || historical.SourceStats[0].SourceKey != models.SourceYahooFinance || historical.SourceStats[0].SourceType != "stocktwits" || historical.SourceStats[0].ArticleLimit != 83 || historical.SourceStats[1].SourceKey != models.SourceCNBCBusiness || historical.SourceStats[1].SourceType != "cnbc_business" || historical.SourceStats[1].ArticleLimit != 31 {
|
||||
t.Fatal("historical outcome was reclassified")
|
||||
}
|
||||
raw, err := json.Marshal(historical)
|
||||
if err != nil || !strings.Contains(string(raw), `"source_key":"yahoo_finance"`) || !strings.Contains(string(raw), `"source_key":"cnbc_business"`) {
|
||||
t.Fatal("legacy source keys disappeared from history")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user