diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-07-29 15:02:07 -0230 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-07-29 15:02:07 -0230 |
| commit | 12aba53395c295880638f7f58f3a00271682bb58 (patch) | |
| tree | d4fb13bf362a4f00538e46721d4465d3ab14b2dc /cost_test.go | |
| parent | 1ba515c30a004bd265052a10e6ca502daf63f92e (diff) | |
| download | lulu-12aba53395c295880638f7f58f3a00271682bb58.zip | |
shorten cost datastructure names
Diffstat (limited to 'cost_test.go')
| -rw-r--r-- | cost_test.go | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/cost_test.go b/cost_test.go index c2f18ec..a02c125 100644 --- a/cost_test.go +++ b/cost_test.go @@ -17,8 +17,8 @@ var ( costRespJson string ) -var costReqSample = printJobCostReq{ - []PrintJobCostLineItem{ +var costReqSample = costReq{ + []CostLineItem{ { 32, PkgId{UsTrade, Mono, Standard, Perfect, P60UncoatedWhite, Matte, NoLinen, NoFoil}, @@ -29,36 +29,32 @@ var costReqSample = printJobCostReq{ 200, }, }, - printJobCostReqShipAddr{ - City: "Lübeck", - Country: "DE", - PostCode: "23552", - State: "", - Street1: "Holstenstr. 40", - Phone: MustParsePhoneNumber("844-212-0689"), + ShippingAddress{ + City: "Lübeck", + CountryCode: "DE", + PostCode: "23552", + Street1: "Holstenstr. 40", + Phone: MustParsePhoneNumber("844-212-0689"), }, Express, } -var printJobCostRespSample = printJobCostResp{ +var costRespSample = costResp{ AddressValidation: ShippingAddressValidation{ Address: ShippingAddress{ - City: "Lübeck", - PostCode: "23552", - Street1: "Holstenstr. 40", - Phone: MustParsePhoneNumber("844-212-0689"), - State: "", - Country: "DE", - IsBusiness: false, - Name: ". .", + City: "Lübeck", + PostCode: "23552", + Street1: "Holstenstr. 40", + Phone: MustParsePhoneNumber("844-212-0689"), + CountryCode: "DE", + IsBusiness: false, + Name: ". .", }, Suggested: ShippingAddress{ - Country: "DE", - State: "", - PostCode: "23552", - City: "Lübeck", - Street1: "Holstenstraße 40", - Street2: "", + CountryCode: "DE", + PostCode: "23552", + City: "Lübeck", + Street1: "Holstenstraße 40", }, Warnings: []ShippingAddressWarning{{ "validation_warning", @@ -128,29 +124,28 @@ var printJobCostRespSample = printJobCostResp{ Currency: "CAD", } -func TestMarshalPrintJobCostReq(t *testing.T) { +func TestMarshalCostReq(t *testing.T) { requireMarshalJsonEq(t, costReqJson, costReqSample) } -func TestUnmarshalPrintJobCostResp(t *testing.T) { - requireUnmarshalJsonEq(t, printJobCostRespSample, costRespJson) +func TestUnmarshalCostResp(t *testing.T) { + requireUnmarshalJsonEq(t, costRespSample, costRespJson) } func TestCost(t *testing.T) { c := newClient(t) - items := costReqSample.LineItems + items := costReqSample.Items addr := ShippingAddress{ - City: "Lübeck", - Country: "DE", - PostCode: "23552", - State: "", - Street1: "Holstenstr. 40", - Phone: MustParsePhoneNumber("844-212-0689"), + City: "Lübeck", + CountryCode: "DE", + PostCode: "23552", + Street1: "Holstenstr. 40", + Phone: MustParsePhoneNumber("844-212-0689"), } shiplvl := costReqSample.ShipOpt cost, av, err := c.Cost(items, addr, shiplvl) require.NoError(t, err) - require.Equal(t, printJobCostRespSample.AddressValidation, av) + require.Equal(t, costRespSample.AddressValidation, av) requireCurrency(t, cost.Currency) for _, fee := range cost.Fees { requireCurrency(t, fee.Currency) |