2022-06-30 14:54:58 -07:00
|
|
|
package input_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-04-23 07:15:38 -07:00
|
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/domain"
|
|
|
|
"git.jamestombleson.com/jtom38/newsbot-api/internal/services/input"
|
2022-06-30 14:54:58 -07:00
|
|
|
)
|
|
|
|
|
2024-04-26 16:05:38 -07:00
|
|
|
var rssRecord = domain.SourceEntity{
|
2022-12-04 08:49:17 -08:00
|
|
|
ID: 1,
|
2024-04-28 10:02:57 -07:00
|
|
|
DisplayName: "ArsTechnica",
|
2022-12-04 08:49:17 -08:00
|
|
|
Url: "https://feeds.arstechnica.com/arstechnica/index",
|
2022-06-30 14:54:58 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestRssClientConstructor(t *testing.T) {
|
|
|
|
input.NewRssClient(rssRecord)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRssGetFeed(t *testing.T) {
|
|
|
|
client := input.NewRssClient(rssRecord)
|
|
|
|
feed, err := client.PullFeed()
|
2022-12-04 08:49:17 -08:00
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
if len(feed.Items) >= 0 {
|
|
|
|
t.Error("failed to collect items from the fees")
|
|
|
|
}
|
2022-06-30 14:54:58 -07:00
|
|
|
|
2022-12-04 08:49:17 -08:00
|
|
|
}
|