aboutsummaryrefslogtreecommitdiffstats
path: root/ship_test.go
blob: a90f22f303118f1c3e8b505bb04e714aa1f766bc (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
40
package lulu

import (
	_ "embed"
	"testing"
)

//go:embed testdata/shipaddrresp.json
var shipAddrRespJson string

var shipAddrSample = ShippingAddress{
	City:        "Lübeck",
	CountryCode: "DE",
	IsBusiness:  false,
	Name:        "Hans Dampf",
	Phone:       MustParsePhoneNumber("844-212-0689"),
	PostCode:    "23552",
	Street1:     "Holstenstr. 40",
}
var shipWarningsSample = []ShippingAddressWarning{{
	Type: "validation_warning",
	Path: "external",
	Code: "REPLACED",
	Msg:  "street1: Holstenstr. 40 -> Holstenstraße 40",
}}
var suggestedShipAddrSample = ShippingAddress{
	CountryCode: "DE",
	PostCode:    "23552",
	City:        "Lübeck",
	Street1:     "Holstenstraße 40",
}
var shipAddrValidationSample = ShippingAddressValidation{
	Address:   shipAddrSample,
	Warnings:  shipWarningsSample,
	Suggested: suggestedShipAddrSample,
}

func TestUnmarshalShippingAddressValidation(t *testing.T) {
	requireUnmarshalJsonEq(t, shipAddrValidationSample, shipAddrRespJson)
}