-
Notifications
You must be signed in to change notification settings - Fork 664
/
page_test.go
44 lines (36 loc) · 1.02 KB
/
page_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package page
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/query"
"github.com/yaoapp/yao/share"
)
func TestLoad(t *testing.T) {
share.DBConnect(config.Conf.DB)
model.Load(config.Conf)
query.Load(config.Conf)
Load(config.Conf)
LoadFrom("not a path", "404.")
check(t)
}
func check(t *testing.T) {
keys := []string{}
for key := range Pages {
keys = append(keys, key)
}
assert.Equal(t, 2, len(keys))
_, err := i18n.Trans("zh-hk", []string{"chart.lang"}, Pages["lang"])
if err != nil {
t.Fatal(err)
}
// lang := Pages["lang"]
// output := lang.Output.(map[string]interface{})
// assert.Equal(t, "{{$in}}", output["參數"])
// filters := lang.Page.Layout["filters"].([]interface{})
// begin := filters[0].(map[string]interface{})
// assert.Equal(t, "開始時間", begin["name"])
// assert.Equal(t, "請選擇開始時間", lang.Filters["開始時間"].Input.Props["placeholder"])
}