yao/widgets/form/form_test.go
2022-10-16 22:23:32 +08:00

48 lines
747 B
Go

package form
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/i18n"
"github.com/yaoapp/yao/model"
"github.com/yaoapp/yao/script"
"github.com/yaoapp/yao/share"
)
func TestLoad(t *testing.T) {
prepare(t)
err := Load(config.Conf)
if err != nil {
t.Fatal(err)
}
assert.Equal(t, 2, len(Forms))
}
func prepare(t *testing.T, language ...string) {
i18n.Load(config.Conf)
share.DBConnect(config.Conf.DB) // removed later
// load scripts
err := script.Load(config.Conf)
if err != nil {
t.Fatal(err)
}
// load models
err = model.Load(config.Conf)
if err != nil {
t.Fatal(err)
}
// load scripts
// export
err = Export()
if err != nil {
t.Fatal(err)
}
}