diff options
Diffstat (limited to 'ship_test.go')
| -rw-r--r-- | ship_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ship_test.go b/ship_test.go new file mode 100644 index 0000000..7643cb3 --- /dev/null +++ b/ship_test.go @@ -0,0 +1,39 @@ +package lulu + +import ( + _ "embed" + "testing" +) + +//go:embed testdata/shipaddrresp.json +var shipAddrRespJson string + +func TestUnmarshalShippingAddressValidation(t *testing.T) { + want := ShippingAddressValidation{ + Address: ShippingAddress{ + City: "Lübeck", + Country: "DE", + IsBusiness: false, + Name: "Hans Dampf", + Phone: MustParsePhoneNumber("844-212-0689"), + PostCode: "23552", + State: "", + Street1: "Holstenstr. 40", + Street2: "", + }, + Warnings: []ShippingAddressWarning{{ + Type: "validation_warning", + Path: "external", + Code: "REPLACED", + Msg: "street1: Holstenstr. 40 -> Holstenstraße 40", + }}, + Suggested: ShippingAddress{ + Country: "DE", + State: "", + PostCode: "23552", + City: "Lübeck", + Street1: "Holstenstraße 40", + }, + } + requireUnmarshalJsonEq(t, want, shipAddrRespJson) +} |