aboutsummaryrefslogtreecommitdiffstats
path: root/ship_test.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-12 15:35:06 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-12 15:37:29 -0400
commit9010ebe8a581fb9db7bc6e97d40ff062fb18495f (patch)
tree4301a455762a59d4951507c8a8781e99c6f91c6d /ship_test.go
parent329257be8d9fb05d3dcea49823acea0f878ed52c (diff)
downloadlulu-9010ebe8a581fb9db7bc6e97d40ff062fb18495f.zip
unmarshal GET /print-jobs response
Diffstat (limited to 'ship_test.go')
-rw-r--r--ship_test.go39
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)
+}