1
0
Fork 1
mirror of https://github.com/hay-kot/homebox.git synced 2024-12-28 01:36:30 +00:00
homebox/backend/internal/config/conf_database_test.go

27 lines
506 B
Go
Raw Normal View History

2022-08-30 02:30:36 +00:00
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() })
}