diff --git a/plugins/zltx/internal/zltx_test.go b/plugins/zltx/internal/zltx_test.go index b4952b5..281bb19 100644 --- a/plugins/zltx/internal/zltx_test.go +++ b/plugins/zltx/internal/zltx_test.go @@ -31,19 +31,33 @@ func TestConfig(t *testing.T) { }) } +func StrIdx(str string, substr string) string { + substr = fmt.Sprintf("%s:", substr) // "order:" "result:" + index := strings.Index(str, substr) + if index == -1 { + return "" + } + return str[index+len(substr):] +} + func TestOrder(t *testing.T) { request := &proto.OrderRequest{ Config: config(), Order: &proto.OrderRequest_Order{ - OrderNo: "test_zltx_4", - Account: "18666666666", - Extra: nil, + OrderNo: "test_zltx_4", + Account: "18666666666", + Quantity: 1, + Extra: nil, }, Product: &proto.OrderRequest_Product{ ProductNo: "106", Extra: []byte(`{}`), }, } + fmt.Println(request.String()) + //fmt.Println(StrIdx(request.String(), "order")) + //fmt.Println(StrIdx(request.String(), "product")) + t.Run("TestOrder", func(t *testing.T) { got, err := zltx.Order(context.Background(), request) if err != nil {