54 lines
871 B
Go
54 lines
871 B
Go
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()
|
|
c := cron.NewScheduler(ctx)
|
|
c.Col()
|
|
}
|
|
|
|
func TestCheckYouTube(t *testing.T) {
|
|
ctx := context.Background()
|
|
c := cron.NewScheduler(ctx)
|
|
c.CheckYoutube()
|
|
}
|
|
|
|
func TestCheckTwitch(t *testing.T) {
|
|
ctx := context.Background()
|
|
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
|
|
}
|