package lulu import ( "testing" ) func TestMarshalUnmarshalShippingAddress(t *testing.T) { for _, pair := range []struct { j string addr ShippingAddress }{ { `{ "city": "Lübeck", "country_code": "DE", "postcode": "23552", "state_code": "", "street1": "Holstenstr. 40", "phone_number": "844-212-0689" }`, ShippingAddress{ "Lübeck", "DE", "23552", "", // TODO: does the API mind if this is "" instead of null? "Holstenstr. 40", "844-212-0689", }, }, { `{ "city": "Anytown", "country_code": "CA", "postcode": "A1A 1A1", "state_code": "QC", "street1": "123 Fake Street", "phone_number": "123-456-7890" }`, ShippingAddress{ "Anytown", "CA", "A1A 1A1", "QC", "123 Fake Street", "123-456-7890", }, }, } { requireMarshalJsonEq(t, pair.j, pair.addr) requireUnmarshalJsonEq(t, pair.addr, pair.j) } }