mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-14 11:02:43 +00:00
20 lines
441 B
Go
20 lines
441 B
Go
package database
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// GetTestDatabase returns a Connector to an in-mem SQLite DB
|
|
func GetTestDatabase(t *testing.T) Connector {
|
|
dbc, err := New("sqlite", "file::memory:?cache=shared", "encpass")
|
|
require.NoError(t, err, "creating database connector")
|
|
t.Cleanup(func() {
|
|
if err := dbc.Close(); err != nil {
|
|
t.Logf("closing in-mem database: %s", err)
|
|
}
|
|
})
|
|
|
|
return dbc
|
|
}
|