This commit is contained in:
李子铭 2024-10-28 13:56:33 +08:00
parent 0eeb2deef0
commit 9131c0b7a6
1 changed files with 5 additions and 17 deletions

View File

@ -54,8 +54,7 @@ func TestOrder(t *testing.T) {
Extra: []byte(`{}`),
},
}
fmt.Println(request.String())
//fmt.Println(StrIdx(request.String(), "order"))
fmt.Println(StrIdx(request.String(), "order"))
//fmt.Println(StrIdx(request.String(), "product"))
t.Run("TestOrder", func(t *testing.T) {
@ -64,6 +63,7 @@ func TestOrder(t *testing.T) {
t.Errorf("Order() error = %v", err)
return
}
fmt.Println(StrIdx(got.String(), "result"))
fmt.Printf("%+v", got)
assert.Equal(t, int(proto.Status_ING), int(got.Result.Status))
})
@ -79,13 +79,7 @@ func TestQuery(t *testing.T) {
Extra: nil,
},
}
requestString := request.String()
index := strings.Index(requestString, "order:")
if index == -1 {
fmt.Println("order: not found in the string")
return
}
fmt.Println(requestString[index+len("order:"):])
fmt.Println(StrIdx(request.String(), "order"))
t.Run("TestQuery", func(t *testing.T) {
got, err := zltx.Query(context.Background(), request)
@ -93,14 +87,7 @@ func TestQuery(t *testing.T) {
t.Errorf("Query() error = %v", err)
return
}
result := got.String()
fmt.Printf("%+v \n", got)
index = strings.Index(result, "result:")
if index == -1 {
fmt.Println("result: not found in the string")
return
}
fmt.Println(result[index+len("result:"):])
fmt.Println(StrIdx(got.String(), "result"))
assert.Equal(t, int(proto.Status_SUCCESS), int(got.Result.Status))
})
@ -113,6 +100,7 @@ func TestNotify(t *testing.T) {
Headers: nil,
Body: []byte(`{"merchantId":23329,"outTradeNo":"202409111714224026320002","rechargeAccount":"18512869479","sign":"474ACB521DEE99551153B6CE108FD06D","status":"01"}`),
}
fmt.Println(in.String())
t.Run("TestNotify", func(t *testing.T) {
got, err := zltx.Notify(context.Background(), in)
if !assert.Nil(t, err) {