forked from YaoApp/yao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_test.go
57 lines (49 loc) · 1.71 KB
/
process_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
45
46
47
48
49
50
51
52
53
54
55
56
57
package importer
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/yaoapp/gou"
)
func TestProcessMapping(t *testing.T) {
simple := filepath.Join("assets", "simple.xlsx")
args := []interface{}{"order", simple}
response := gou.NewProcess("xiang.import.Mapping", args...).Run()
_, ok := response.(*Mapping)
assert.True(t, ok)
}
func TestProcessMappingSetting(t *testing.T) {
simple := filepath.Join("assets", "simple.xlsx")
args := []interface{}{"order", simple}
response := gou.NewProcess("xiang.import.MappingSetting", args...).Run()
_, ok := response.(map[string]interface{})
assert.True(t, ok)
}
func TestProcessData(t *testing.T) {
simple := filepath.Join("assets", "simple.xlsx")
mapping := gou.NewProcess("xiang.import.Mapping", "order", simple).Run()
args := []interface{}{"order", simple, 1, 2, mapping}
response := gou.NewProcess("xiang.import.Data", args...).Run()
_, ok := response.(map[string]interface{})
assert.True(t, ok)
}
func TestProcessDataSetting(t *testing.T) {
args := []interface{}{"order"}
response := gou.NewProcess("xiang.import.DataSetting", args...).Run()
_, ok := response.(map[string]interface{})
assert.True(t, ok)
}
func TestProcessSetting(t *testing.T) {
args := []interface{}{"order"}
response := gou.NewProcess("xiang.import.Setting", args...).Run()
_, ok := response.(map[string]interface{})
assert.True(t, ok)
}
func TestProcessRun(t *testing.T) {
simple := filepath.Join("assets", "simple.xlsx")
mapping := gou.NewProcess("xiang.import.Mapping", "order", simple).Run()
args := []interface{}{"order", simple, mapping}
response := gou.NewProcess("xiang.import.Run", args...).Run()
_, ok := response.(map[string]int)
assert.True(t, ok)
}