twitter-scrapper/trends_test.go

26 lines
439 B
Go
Raw Normal View History

2021-12-07 10:18:01 +02:00
package twitterscraper_test
2020-02-12 10:45:19 +02:00
import (
"testing"
2021-12-07 10:18:01 +02:00
twitterscraper "github.com/n0madic/twitter-scraper"
2020-02-12 10:45:19 +02:00
)
func TestGetTrends(t *testing.T) {
2022-05-04 11:55:12 +03:00
scraper := twitterscraper.New()
trends, err := scraper.GetTrends()
2020-02-12 10:45:19 +02:00
if err != nil {
t.Error(err)
}
if len(trends) != 20 {
t.Errorf("Expected 20 trends, got %d: %#v", len(trends), trends)
}
for _, trend := range trends {
if trend == "" {
2021-04-22 20:35:33 +03:00
t.Error("Expected trend is empty")
}
2020-02-12 10:45:19 +02:00
}
}