yao/table/table_test.go
2021-10-19 00:17:22 +08:00

29 lines
508 B
Go

package table
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/yaoapp/xiang/config"
"github.com/yaoapp/xiang/model"
"github.com/yaoapp/xiang/share"
)
func TestLoad(t *testing.T) {
share.DBConnect(config.Conf.Database)
model.Load(config.Conf)
Tables = make(map[string]*Table)
Load(config.Conf)
LoadFrom("not a path", "404.")
check(t)
}
func check(t *testing.T) {
keys := []string{}
for key := range Tables {
keys = append(keys, key)
}
assert.Equal(t, 2, len(keys))
}