package dbx import ( "testing" "gitea.auvem.com/go-toolkit/dbx/internal/dbxshared" "github.com/stretchr/testify/assert" ) func TestDestName_MissingFieldWithoutModule(t *testing.T) { type Foo struct { Bar int } name := DestName(Foo{}, "Missing") assert.Empty(t, name) } func TestDestName_ValidPath(t *testing.T) { type Inner struct { Value string } type Foo struct { Inner Inner } name := DestName(Foo{}, "Inner", "Value") assert.Equal(t, "Foo.Inner.Value", name) } func TestDialect_AfterModuleDB(t *testing.T) { if dbxshared.DBModule != nil { t.Skip("database module already initialized") } _ = ModuleDB(DialectPostgres, &DBConfig{ User: "user", Password: "pass", URI: "localhost:5432", Name: "test", MaxConn: 1, }, false) assert.Equal(t, DialectPostgres, CurrentDialect()) }