newsbot-api/internal/services/input/rss_test.go

44 lines
1020 B
Go

package input_test
import (
"testing"
"git.jamestombleson.com/jtom38/newsbot-api/domain"
"git.jamestombleson.com/jtom38/newsbot-api/internal/entity"
"git.jamestombleson.com/jtom38/newsbot-api/internal/services/input"
)
var rssRecord = entity.SourceEntity{
ID: 1,
DisplayName: "ArsTechnica",
Url: "https://feeds.arstechnica.com/arstechnica/index",
Source: domain.SourceCollectorRss,
}
func TestRssClientConstructor(t *testing.T) {
input.NewRssClient(rssRecord)
}
func TestRssGetFeed(t *testing.T) {
client := input.NewRssClient(rssRecord)
_, err := client.GetArticles()
if err != nil {
t.Error(err)
}
}
func TestRssAgainstGita(t *testing.T) {
client := input.NewRssClient(entity.SourceEntity{
ID: 2,
DisplayName: "Gitea - Newsbot-api",
Source: domain.SourceCollectorRss,
Url: "https://git.jamestombleson.com/jtom38/newsbot-api.rss",
Tags: "rss,gitea,newsbot-api",
})
_, err := client.GetArticles()
if err != nil {
t.Error(err)
}
}