aboutsummaryrefslogtreecommitdiffstats
path: root/print_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'print_test.go')
-rw-r--r--print_test.go42
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"