From 48f85453ffbe36f6c428a5d9a23b74122686b64c Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 13 May 2026 15:47:33 -0400 Subject: test marshal print and reprint requests --- print_test.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'print_test.go') diff --git a/print_test.go b/print_test.go index ec4e455..ce9fbda 100644 --- a/print_test.go +++ b/print_test.go @@ -101,6 +101,48 @@ func TestGetPrintJobs(t *testing.T) { require.NoError(t, err) } +//go:embed testdata/printreq.json +var printReqJson string + +func TestMarshalPrintReq(t *testing.T) { + req := printReq[Printable]{ + Contact: MustParseEmailAddress("test@test.com"), + ExternalId: "demo-time", + LineItems: []Printable{{ + ExternalId: "item-reference-1", + CoverUrl: "https://www.dropbox.com/s/7bv6mg2tj0h3l0r/lulu_trade_perfect_template.pdf?dl=1&raw=1", + InteriorUrl: "https://www.dropbox.com/s/r20orb8umqjzav9/lulu_trade_interior_template-32.pdf?dl=1&raw=1", + Mfg: PkgId{UsTrade, Mono, Standard, Perfect, P60UncoatedWhite, Matte, NoLinen, NoFoil}, + Quantity: 30, + Title: "My Book", + }}, + ProductionDelayMins: 120, + ShipAddr: shipAddrSample, + ShipOpt: Mail, + } + requireMarshalJsonEq(t, printReqJson, req) +} + +//go:embed testdata/reprintreq.json +var reprintReqJson string + +func TestMarshalReprintReq(t *testing.T) { + req := printReq[Reprintable]{ + Contact: MustParseEmailAddress("test@test.com"), + ExternalId: "demo-time", + LineItems: []Reprintable{{ + ExternalId: "item-reference-1", + PrintableId: PrintableId("11606ab3-9355-46d3-ae90-338db6f5d271"), + Quantity: 30, + Title: "My Book", + }}, + ProductionDelayMins: 120, + ShipAddr: shipAddrSample, + ShipOpt: Mail, + } + requireMarshalJsonEq(t, reprintReqJson, req) +} + func TestPrint(t *testing.T) { contact := MustParseEmailAddress("test@test.com") jobEid := "demo-time" -- cgit v1.2.3