Merge pull request #22 from KISI/master

change type of Item.Amount from string to int to get it working with …
This commit is contained in:
Aliaksandr Pliutau 2017-02-07 16:14:40 +07:00 committed by GitHub
commit 0b9ce9a464
2 changed files with 3 additions and 3 deletions

View File

@ -193,7 +193,7 @@ type (
// Item struct
Item struct {
Quantity string `json:"quantity"`
Quantity int `json:"quantity"`
Name string `json:"name"`
Price string `json:"price"`
Currency string `json:"currency"`

View File

@ -36,7 +36,7 @@ func TestTypeItem(t *testing.T) {
"name":"Item",
"price":"22.99",
"currency":"GBP",
"quantity":"1"
"quantity":1
}`
i := &Item{}
@ -48,7 +48,7 @@ func TestTypeItem(t *testing.T) {
if i.Name != "Item" ||
i.Price != "22.99" ||
i.Currency != "GBP" ||
i.Quantity != "1" {
i.Quantity != 1 {
t.Errorf("Item decoded result is incorrect, Given: %v", i)
}
}