Synthetic generic page text.
package articlecontent import ( "fmt" "strings" "testing" "github.com/tradarr/backend/internal/scraper" ) func TestCandidateLengthUnicodeBucketsAndExcludedText(t *testing.T) { for _, source := range []string{"yahoo_finance", "cnbc_business"} { pages := map[string]string{} root, base := "caas-body", "https://finance.yahoo.com/news/fixture-" if source == "cnbc_business" { root = "ArticleBody-articleBody" base = "https://www.cnbc.com/2026/02/01/fixture-" } for i, n := range []int{0, 1, 500, 501, 2000, 2001} { target := fmt.Sprintf("%s%d.html", base, i) pages[target] = `
` + strings.Repeat("界", n) + `
Excluded outside text
` } m := fetchMetricsForFixturePages(t, source, pages) if !m.CandidateBodySupported || m.CandidateLength != (scraper.LengthCounts{Zero: 1, Small: 2, Medium: 2, Large: 1}) || m.Length.Zero != 6 || m.Content.Unavailable != 6 { t.Fatal("candidate Unicode/exclusion buckets changed article results") } } } func TestCandidateLengthNormalizesEditorialWhitespaceWithoutRetainingContent(t *testing.T) { const target = "https://finance.yahoo.com/news/fixture.html" pages := map[string]string{target: `A Unicode 界 body
text.
Synthetic generic page text.
First ambiguous root.
Second ambiguous root.