aboutsummaryrefslogtreecommitdiffstats
path: root/ship_test.go
blob: 7643cb3d600ae0d80832f7ab6a4ee073bc665cbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)
}