Skip to content

Commit

Permalink
fix load test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Oct 7, 2021
1 parent 6ae845c commit 7ce9552
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions global/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/yaoapp/xiang/config"
"github.com/yaoapp/xiang/table"
)

func TestLoad(t *testing.T) {
defer Load(config.Conf)
assert.NotPanics(t, func() {
Load(Conf)
Load(config.Conf)
})
}

// 从文件系统载入引擎文件
func TestLoadEngineFS(t *testing.T) {
root := "fs://" + path.Join(Conf.Source, "/xiang")
defer Load(config.Conf)
root := "fs://" + path.Join(config.Conf.Source, "/xiang")
assert.NotPanics(t, func() {
LoadEngine(root)
})
Expand All @@ -25,6 +28,7 @@ func TestLoadEngineFS(t *testing.T) {

// 从BinDataz载入引擎文件
func TestLoadEngineBin(t *testing.T) {
defer Load(config.Conf)
root := "bin://xiang"
assert.NotPanics(t, func() {
LoadEngine(root)
Expand All @@ -33,21 +37,22 @@ func TestLoadEngineBin(t *testing.T) {

// 从文件系统载入应用脚本
func TestLoadAppFS(t *testing.T) {
defer Load(config.Conf)
assert.NotPanics(t, func() {
LoadApp(AppRoot{
APIs: Conf.RootAPI,
Flows: Conf.RootFLow,
Models: Conf.RootModel,
Plugins: Conf.RootPlugin,
Tables: Conf.RootTable,
Charts: Conf.RootChart,
Screens: Conf.RootScreen,
APIs: config.Conf.RootAPI,
Flows: config.Conf.RootFLow,
Models: config.Conf.RootModel,
Plugins: config.Conf.RootPlugin,
Tables: config.Conf.RootTable,
Charts: config.Conf.RootChart,
Screens: config.Conf.RootScreen,
})
})
}

func TestTableLoad(t *testing.T) {

defer Load(config.Conf)
table, has := table.Tables["service"]
assert.Equal(t, table.Table, "service")
assert.True(t, has)
Expand Down

0 comments on commit 7ce9552

Please sign in to comment.