James Tombleson
0e0058506a
* added feature flags around background workers * background workers are moved to a new package as outputs are starting to get added * package name was updated * updated refs to the new input package * query and sql updates on routes * moved the services and starting to add discord web hook * query update
33 lines
721 B
Go
33 lines
721 B
Go
package input_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/jtom38/newsbot/collector/database"
|
|
"github.com/jtom38/newsbot/collector/services/input"
|
|
)
|
|
|
|
var RedditRecord database.Source = database.Source{
|
|
ID: uuid.New(),
|
|
Name: "dadjokes",
|
|
Source: "reddit",
|
|
Site: "reddit",
|
|
Url: "https://reddit.com/r/dadjokes",
|
|
Tags: "reddit, dadjokes",
|
|
}
|
|
|
|
func TestGetContent(t *testing.T) {
|
|
//This test is flaky right now due to the http changes in 1.17
|
|
rc := input.NewRedditClient(RedditRecord)
|
|
raw, err := rc.GetContent()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
redditArticles := rc.ConvertToArticles(raw)
|
|
for _, posts := range redditArticles {
|
|
if posts.Title == "" {
|
|
t.Error("Title is missing")
|
|
}
|
|
}
|
|
} |