aboutsummaryrefslogtreecommitdiffstats
path: root/pod_test.go
blob: c54b8e5a14e476a5aa7ef9946b844b0836f0872a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package lulu_test

import (
	"encoding/json"
	"testing"

	"github.com/stretchr/testify/require"

	"git.samanthony.xyz/lulu"
)

func TestPod(t *testing.T) {
	t.Parallel()
	requireJsonEq(t,
		"0850X1100.BW.STD.LW.060UW444.MNG",
		lulu.PodPkgId{
			lulu.UsLetter,
			lulu.Mono,
			lulu.Standard,
			lulu.LinenWrap,
			lulu.P60UncoatedWhite,
			lulu.Matte,
			lulu.NavyLinen,
			lulu.GoldFoil})
	requireJsonEq(t,
		"0600X0900.FC.STD.PB.080CW444.GXX",
		lulu.PodPkgId{
			lulu.UsTrade,
			lulu.Color,
			lulu.Standard,
			lulu.Perfect,
			lulu.P80CoatedWhite,
			lulu.Gloss,
			lulu.NoLinen,
			lulu.NoFoil})
	requireJsonEq(t,
		"0700X1000.FC.PRE.CO.060UC444.MXX",
		lulu.PodPkgId{
			lulu.Executive,
			lulu.Color,
			lulu.Premium,
			lulu.Coil,
			lulu.P60UncoatedCream,
			lulu.Matte,
			lulu.NoLinen,
			lulu.NoFoil})
	requireJsonEq(t,
		"0600X0900.BW.STD.PB.060UW444.MXX",
		lulu.PodPkgId{
			lulu.UsTrade,
			lulu.Mono,
			lulu.Standard,
			lulu.Perfect,
			lulu.P60UncoatedWhite,
			lulu.Matte,
			lulu.NoLinen,
			lulu.NoFoil})
}

func requireJsonEq(t *testing.T, expected string, actual json.Marshaler) {
	t.Helper()
	a, err := json.Marshal(expected)
	require.NoError(t, err)
	b, err := json.Marshal(actual)
	require.NoError(t, err)
	require.JSONEq(t, string(a), string(b))
}