homebox/backend/internal/config/conf_database_test.go
2022-09-04 16:41:12 -08:00

26 lines
506 B
Go

package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_DatabaseConfig_Sqlite(t *testing.T) {
dbConf := &Database{
Driver: DriverSqlite3,
SqliteUrl: "file:ent?mode=memory&cache=shared&_fk=1",
}
assert.Equal(t, "sqlite3", dbConf.GetDriver())
assert.Equal(t, "file:ent?mode=memory&cache=shared&_fk=1", dbConf.GetUrl())
}
func Test_DatabaseConfig_Unknown(t *testing.T) {
dbConf := &Database{
Driver: "null",
}
assert.Panics(t, func() { dbConf.GetUrl() })
}