forked from SunRed/discord-tweeter
* Update golang version to 1.24 * Update multiarch Dockerfile to be more ISA agnostic * Refactor existing code and properly structure project into modules * Get rid of global variables except where necessary (go:embed) * Add default values to Config * Add webserver with templates to finally correctly serve videos and gifs * Add tiny caching library to decrease api load and improve latency * Improve Webhook data preparation by filtering out redundant links from the tweet text and properly attaching videos and gifs in separate webhook request by utilising new webserver * Improve tests for filter function * Improve bake definition for easier CI integration
55 lines
677 B
Go
55 lines
677 B
Go
package db
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
const (
|
|
testDbPath = "../data/testdb.db"
|
|
)
|
|
|
|
var (
|
|
connection *sqlx.DB
|
|
)
|
|
|
|
func setupSuite(t *testing.T) func(t *testing.T) {
|
|
conn, err := sqlx.Connect("sqlite3", testDbPath)
|
|
if err != nil {
|
|
t.Errorf("")
|
|
}
|
|
connection = conn
|
|
|
|
return func(t *testing.T) {
|
|
conn.Close()
|
|
}
|
|
}
|
|
|
|
func setupTest(t *testing.T) func(t *testing.T) {
|
|
|
|
return func(t *testing.T) {
|
|
|
|
}
|
|
}
|
|
|
|
func TestGetNewestTweet(t *testing.T) {
|
|
|
|
}
|
|
|
|
func TestGetTweets(t *testing.T) {
|
|
|
|
}
|
|
|
|
func TestContainsTweet(t *testing.T) {
|
|
|
|
}
|
|
|
|
func TestInsertTweet(t *testing.T) {
|
|
|
|
}
|
|
|
|
func TestPruneOldestTweets(t *testing.T) {
|
|
|
|
}
|