newsbot-api/internal/services/cron/scheduler_test.go

54 lines
871 B
Go
Raw Permalink Normal View History

package cron_test
import (
"database/sql"
"github.com/pressly/goose/v3"
)
/*
func TestInvokeTwitch(t *testing.T) {
}
// TODO add database mocks but not sure how to do that yet.
func TestCheckReddit(t *testing.T) {
ctx := context.Background()
2024-04-23 07:15:38 -07:00
c := cron.NewScheduler(ctx)
c.Col()
}
func TestCheckYouTube(t *testing.T) {
ctx := context.Background()
2024-04-23 07:15:38 -07:00
c := cron.NewScheduler(ctx)
c.CheckYoutube()
}
func TestCheckTwitch(t *testing.T) {
ctx := context.Background()
2024-04-23 07:15:38 -07:00
c := cron.NewScheduler(ctx)
err := c.CheckTwitch()
if err != nil {
t.Error(err)
}
}
*/
func setupInMemoryDb() (*sql.DB, error) {
db, err := sql.Open("sqlite", ":memory:")
if err != nil {
return nil, err
}
err = goose.SetDialect("sqlite3")
if err != nil {
return nil, err
}
err = goose.Up(db, "../../database/migrations")
if err != nil {
return nil, err
}
return db, nil
}