diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-13 15:47:33 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-13 15:47:33 -0400 |
| commit | 48f85453ffbe36f6c428a5d9a23b74122686b64c (patch) | |
| tree | 13720a581029307fd9303f025d9cd8c1012261b3 /print_test.go | |
| parent | 66ef9438a3489bf8a0b80bb44e320c85261a6658 (diff) | |
| download | lulu-48f85453ffbe36f6c428a5d9a23b74122686b64c.zip | |
test marshal print and reprint requests
Diffstat (limited to 'print_test.go')
| -rw-r--r-- | print_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
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" |