package cron_test import ( "context" "testing" "git.jamestombleson.com/jtom38/newsbot-api/internal/domain" "git.jamestombleson.com/jtom38/newsbot-api/internal/services" "git.jamestombleson.com/jtom38/newsbot-api/internal/services/cron" ) func TestRssPullsCorrectly(t *testing.T) { conn, err := setupInMemoryDb() if err != nil { t.Error(err) t.FailNow() } defer conn.Close() ctx := context.Background() db := services.NewRepositoryService(conn) rowsCreated, err := db.Sources.Create(ctx, domain.SourceCollectorRss, "Gitea - Newsbot.api", "https://git.jamestombleson.com/jtom38/newsbot-api.rss", "rss,gitea,newsbot.api", true) if err != nil { t.Error(err) t.FailNow() } if rowsCreated != 1 { t.Error("failed to create the source record") t.FailNow() } client := cron.NewScheduler(ctx, conn) client.CollectRssPosts() articles, err := db.Articles.ListByPage(ctx, 0, 100) if err != nil { t.Error(err) t.FailNow() } t.Log(len(articles)) }