1
1
package repo
2
2
3
3
import (
4
+ "testing"
5
+
4
6
"github.com/OpenBazaar/jsonpb"
5
7
"github.com/OpenBazaar/openbazaar-go/pb"
6
- "testing"
7
8
)
8
9
9
10
func TestToV5Order (t * testing.T ) {
@@ -22,7 +23,7 @@ func TestToV5Order(t *testing.T) {
22
23
RefundFee : 1000 ,
23
24
Payment : & pb.Order_Payment {},
24
25
},
25
- expected : `{"payment":{"method":"ADDRESS_REQUEST"},"bigRefundFee":"1000"}` ,
26
+ expected : `{"payment":{"method":"ADDRESS_REQUEST","amountCurrency":{"code":"BTC","divisibility":8} },"bigRefundFee":"1000"}` ,
26
27
},
27
28
{
28
29
name : "item quantity test" ,
@@ -34,7 +35,7 @@ func TestToV5Order(t *testing.T) {
34
35
},
35
36
Payment : & pb.Order_Payment {},
36
37
},
37
- expected : `{"items":[{"bigQuantity":"19"}],"payment":{"method":"ADDRESS_REQUEST"}}` ,
38
+ expected : `{"items":[{"bigQuantity":"19"}],"payment":{"method":"ADDRESS_REQUEST","amountCurrency":{"code":"BTC","divisibility":8} }}` ,
38
39
},
39
40
{
40
41
name : "item quantity64 test" ,
@@ -46,7 +47,7 @@ func TestToV5Order(t *testing.T) {
46
47
},
47
48
Payment : & pb.Order_Payment {},
48
49
},
49
- expected : `{"items":[{"bigQuantity":"19"}],"payment":{"method":"ADDRESS_REQUEST"}}` ,
50
+ expected : `{"items":[{"bigQuantity":"19"}],"payment":{"method":"ADDRESS_REQUEST","amountCurrency":{"code":"BTC","divisibility":8} }}` ,
50
51
},
51
52
{
52
53
name : "payment amount test" ,
@@ -55,7 +56,7 @@ func TestToV5Order(t *testing.T) {
55
56
Amount : 2000 ,
56
57
},
57
58
},
58
- expected : `{"payment":{"method":"ADDRESS_REQUEST","bigAmount":"2000"}}` ,
59
+ expected : `{"payment":{"method":"ADDRESS_REQUEST","bigAmount":"2000","amountCurrency":{"code":"BTC","divisibility":8} }}` ,
59
60
},
60
61
{
61
62
name : "payment amount currency" ,
@@ -78,7 +79,6 @@ func TestToV5Order(t *testing.T) {
78
79
if err != nil {
79
80
t .Errorf ("Test %s marshalling failed: %s" , test .name , err )
80
81
}
81
-
82
82
if out != test .expected {
83
83
t .Errorf ("Test %s incorrect output: Expected %s, got %s" , test .name , test .expected , out )
84
84
}
0 commit comments