Total refactoring
Used guest frontend API BREAKING CHANGE: remove tweet.HTML property Loading more information Minor fixes and changes
This commit is contained in:
parent
1c582e142e
commit
edad8f6393
15 changed files with 628 additions and 497 deletions
|
|
@ -7,21 +7,25 @@ import (
|
|||
|
||||
func TestGetTweets(t *testing.T) {
|
||||
count := 0
|
||||
maxTweetsNbr := 50
|
||||
maxTweetsNbr := 300
|
||||
dupcheck := make(map[string]bool)
|
||||
for tweet := range GetTweets(context.Background(), "Twitter", maxTweetsNbr) {
|
||||
if tweet.Error != nil {
|
||||
t.Error(tweet.Error)
|
||||
} else {
|
||||
count++
|
||||
if tweet.HTML == "" {
|
||||
t.Error("Expected tweet HTML is not empty")
|
||||
}
|
||||
if tweet.ID == "" {
|
||||
t.Error("Expected tweet ID is not empty")
|
||||
} else {
|
||||
if dupcheck[tweet.ID] {
|
||||
t.Errorf("Detect duplicated tweet ID: %s", tweet.ID)
|
||||
} else {
|
||||
dupcheck[tweet.ID] = true
|
||||
}
|
||||
}
|
||||
if tweet.UserID == "" {
|
||||
t.Error("Expected tweet UserID is not empty")
|
||||
}
|
||||
// if tweet.UserID == "" {
|
||||
// t.Error("Expected tweet UserID is not empty")
|
||||
// }
|
||||
if tweet.Username == "" {
|
||||
t.Error("Expected tweet Username is not empty")
|
||||
}
|
||||
|
|
@ -37,6 +41,17 @@ func TestGetTweets(t *testing.T) {
|
|||
if tweet.Timestamp == 0 {
|
||||
t.Error("Expected tweet Timestamp is greater than zero")
|
||||
}
|
||||
for _, video := range tweet.Videos {
|
||||
if video.ID == "" {
|
||||
t.Error("Expected tweet video ID is not empty")
|
||||
}
|
||||
if video.Preview == "" {
|
||||
t.Error("Expected tweet video Preview is not empty")
|
||||
}
|
||||
if video.URL == "" {
|
||||
t.Error("Expected tweet video URL is not empty")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if count != maxTweetsNbr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue