31 lines
619 B
Go
31 lines
619 B
Go
package input_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain"
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/services/input"
|
|
)
|
|
|
|
var rssRecord = domain.SourceEntity{
|
|
ID: 1,
|
|
DisplayName: "ArsTechnica",
|
|
Url: "https://feeds.arstechnica.com/arstechnica/index",
|
|
}
|
|
|
|
func TestRssClientConstructor(t *testing.T) {
|
|
input.NewRssClient(rssRecord)
|
|
}
|
|
|
|
func TestRssGetFeed(t *testing.T) {
|
|
client := input.NewRssClient(rssRecord)
|
|
feed, err := client.PullFeed()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
if len(feed.Items) >= 0 {
|
|
t.Error("failed to collect items from the fees")
|
|
}
|
|
|
|
}
|